Maven 2 maven exec插件:org.apache.maven.plugin.MojoExecutionException和ClassNotFoundException

Maven 2 maven exec插件:org.apache.maven.plugin.MojoExecutionException和ClassNotFoundException,maven-2,Maven 2,执行maven程序时出现异常。 我正在使用maven 2.2 在使用maven执行类时获取此异常。 这是我的pom.xml <modelVersion>4.0.0</modelVersion> <groupId>com.infrasoft.ibs.retail</groupId> <artifactId>ibs-project</artifactId> <version>1.0-SNAPSHOT</vers

执行maven程序时出现异常。 我正在使用maven 2.2 在使用maven执行类时获取此异常。 这是我的pom.xml

<modelVersion>4.0.0</modelVersion>
<groupId>com.infrasoft.ibs.retail</groupId>
<artifactId>ibs-project</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ibs-project</name>

<properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

    <dependencies>
    <dependency>
        <groupId>org.apache.shiro</groupId>
        <artifactId>shiro-core</artifactId>
        <version>1.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <source>1.5</source>
                <target>1.5</target>
                <encoding>${project.build.sourceEncoding}</encoding>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <classpathScope>test</classpathScope>
                <mainClass>ShiroDemo</mainClass>
            </configuration>
        </plugin>

    </plugins>
</build>
请帮忙,原因是什么? 提前谢谢

编辑

好的,当我离开的时候

   <configuration>
            <classpathScope>test</classpathScope>
            <mainClass>ShiroDemo</mainClass>
        </configuration>

从pom.xml开始,并使用followin命令执行,它工作正常。mvn compile exec:java-Dexec.mainClass=org.sample.test.ShiroDemo-e

您不需要指定-Dexec.mainClass。配置正确,只是pom.xml中没有。将其更改为以下内容:

<mainClass>org.sample.test.ShiroDemo</mainClass>

请在这里粘贴例外。如果你不先告诉我们问题出在哪里,我们该如何帮助你?你用Maven干什么?异常的堆栈跟踪是什么?这些是最基本的信息,没有这些信息就无法回答您的问题。你不这么认为吗?我会粘贴堆栈跟踪。请不要问诸如“你用maven做什么?”之类的天真问题。如果你能在这里贡献你的知识,我将不胜感激。随你便。我只是想帮你我猜这是因为你把classpathScope设置为test。删除该行,看看它是否有效。您好,谢谢您的回复,但即使删除该行,也会出现相同的错误。
<mainClass>org.sample.test.ShiroDemo</mainClass>