Maven无法运行我的项目:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec [英] Maven won't run my Project : Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

查看:258
本文介绍了Maven无法运行我的项目:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法运行Maven Netbeans JavaFX示例:

I can't run the Maven Netbeans JavaFX example :

无法在以下目标上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli) project mavenproject3:命令执行失败.流程退出 错误:1(退出值:1)-> [帮助1]

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mavenproject3: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

要查看错误的完整堆栈跟踪,请使用-e重新运行Maven. 转变.使用-X开关重新运行Maven以启用完整的调试日志记录.

To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.

我的POM如下所示:

<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.huw.almexoffice.client</groupId>
<artifactId>almex-office-client</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Almex Office Client</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mainClass>com.huw.almexoffice.client.MainApp</mainClass>
</properties>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>Your Organisation</name>
</organization>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <excludeScope>system</excludeScope>
                        <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                        <outputDirectory>${project.build.directory}/classes</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>            
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>

                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>${java.home}/../bin/javafxpackager</executable>
                        <arguments>
                            <argument>-createjar</argument>
                            <argument>-nocss2bin</argument>
                            <argument>-appclass</argument>
                            <argument>${mainClass}</argument>
                            <argument>-srcdir</argument>
                            <argument>${project.build.directory}/classes</argument>
                            <argument>-outdir</argument>
                            <argument>${project.build.directory}</argument>
                            <argument>-outfile</argument>
                            <argument>${project.build.finalName}.jar</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>  
        </plugin>



        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>
    </plugins>
</build>

有人知道为什么会这样吗?

Does anyone know why this is happening?

如果没有,没有人知道如何通过Netbeans使Maven与-e或-X开关一起运行吗?我认为是通过右键单击POM,然后运行目标,然后在此处的文本字段中输入内容.

And if not, does anyone know how to get Maven running with the -e or the -X switch via Netbeans? I assume it is via a right click on the POM and then run goal then entering something in the textfield there.

推荐答案

  1. 该错误会任意出现,并且尽管我的代码很可靠,但也造成了很多麻烦.

我做了以下事情:

  • 我在netbeans上关闭了它.
  • 然后通过单击打开项目",选择我的项目,然后打开
  • 只需按一下netbeans中的运行按钮.

我不会构建或清理它.希望对您有帮助.

I would not build or clean build it. Hope that helps you out.

  1. 我注意到发生这种情况的另一个原因.如果将主类移至另一个包,则会出现相同的错误.在这种情况下,您:
    • 右键单击项目">属性">运行"
    • 通过单击浏览"并选择正确设置主类".
  1. I noticed another reason why this happens. If you moved your main class to another package, the same error springs up. In that case you :
    • Right Click Project > Properties > Run
    • Set the "Main Class" correctly by clicking "Browse" and selecting.

这篇关于Maven无法运行我的项目:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆