Maven java-jar-Dapple.awt.UIElement=";“真的”;target/MyAppName-1.0-SNAPSHOT.jar-h找不到类名

Maven java-jar-Dapple.awt.UIElement=";“真的”;target/MyAppName-1.0-SNAPSHOT.jar-h找不到类名,maven,cmd,load,main,snapshot,Maven,Cmd,Load,Main,Snapshot,我在Eclipse中编写了maven项目。它在Eclipse中正确运行。我想在cmd中运行这个项目,所以我写 java -jar -Dapple.awt.UIElement="true" target/myAppName-1.0-SNAPSHOT.jar -h 在命令行中,但我有这个错误 找不到或加载主类com.mypacketname.myAppName 在我的pom.xml中 <project xmlns="http://maven.apache.org/POM/4.0.0" xm

我在Eclipse中编写了maven项目。它在Eclipse中正确运行。我想在cmd中运行这个项目,所以我写

java -jar -Dapple.awt.UIElement="true" target/myAppName-1.0-SNAPSHOT.jar -h 
在命令行中,但我有这个错误

找不到或加载主类com.mypacketname.myAppName

在我的pom.xml中

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.hasanozgan.challenge</groupId>
<artifactId>persona</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>persona</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jdk.version>1.6</jdk.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7.2</version>
            <configuration>
                <skipTests>false</skipTests>
            </configuration>
        </plugin>




        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathLayoutType>repository</classpathLayoutType>
                        <classpathPrefix>${settings.localRepository}</classpathPrefix>

                        <mainClass>com.hasanozgan.challenge.App</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <!-- <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> 
            <execution> <id>copy</id> <phase>install</phase> <goals> <goal>copy-dependencies</goal> 
            </goals> <configuration> <outputDirectory> ${project.build.directory}/lib 
            </outputDirectory> </configuration> </execution> </executions> </plugin> -->
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.7.2</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.morphia</groupId>
        <artifactId>morphia</artifactId>
        <version>0.99.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.1.2.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.1.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>3.1.2.RELEASE</version>
    </dependency>

</dependencies>

<repositories>
    <repository>
        <id>morphia</id>
        <url>http://morphia.googlecode.com/svn/mavenrepo/</url>
    </repository>
</repositories>

4.0.0
com.hasanozgan.challenge
人格面具
1.0-快照
罐子
人格面具
http://maven.apache.org
UTF-8
1.6
org.apache.maven.plugins
maven surefire插件
2.7.2
假的
org.apache.maven.plugins
maven jar插件
2.4
真的
存储库
${settings.localRepository}
com.hasanozgan.challenge.App
org.mockito
莫基托所有
1.9.5
log4j
log4j
1.2.14
运行时
朱尼特
朱尼特
4.10
测试
org.mongodb
mongo java驱动程序
2.7.2
com.google.code.morphia
吗啡
0.99.1-1快照
commons cli
commons cli
1.2
org.springframework
弹簧芯
3.1.2.1发布
org.springframework
spring上下文
3.1.2.1发布
org.springframework
弹簧试验
3.1.2.1发布
吗啡
http://morphia.googlecode.com/svn/mavenrepo/


但是我还是犯了同样的错误。我怎么解决呢?

我不确定,但是你是否尝试删除了
标记内容末尾的空白字符?@MarkusWMahlberg没有发生任何变化:(您在哪个目录中键入命令?@Tunaki-its-directory项目。我在项目directoy中使用了cd命令,但仍然有相同的错误。@question\u maven\u com我添加了所有有问题的pom.xml。