Maven won't run my Project : Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

后端 未结 14 657
暖寄归人
暖寄归人 2020-12-09 04:21

I can\'t run the Maven Netbeans JavaFX example :

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exe         


        
相关标签:
14条回答
  • 2020-12-09 04:52

    Had the same problem after installing oracle jdk on Ubuntu 13.10 x64.

    I've done the following steps, not sure which one helped. I think that at least 2 and 3 are necessary.

    1. Deleted Netbeans 7.4 and reinstalled it from oracle's site.
    2. Installed plugins for maven, ant and java that may be related to the project.
    3. Deleted .nbproject folder - after that the project was considered a maven project.

    Also, after that, I've found that the project runs, but exits with exit code 1 because I didn't supply the command line parameters for it. And the builder considers it is an error. So, look carefully for the output and see if the program actually starts.

    0 讨论(0)
  • 2020-12-09 04:54

    Had the same problem, I worked around it by changing ${java.home}/../bin/javafxpackager to ${java.home}/bin/javafxpackager

    0 讨论(0)
  • 2020-12-09 04:55

    For me, the clue was the "org.codehaus.mojo:exec-maven-plugin:1.2.1:exec".
    The only place this was referenced was in the "Run project" action under Project Properties=>Actions.

    When I changed this action to match the HelloFXMLWithMaven sample project (available in Netbeans 11.1): "clean javafx:run" then executing the Run goal was able to proceed.

    Note, I also had to update the pom file's javafx-maven-plugin to also match the sample project but with the mainClass changed for my project.

    0 讨论(0)
  • 2020-12-09 04:56

    Netbeans needs to be able to index the maven repository. Allow it to do that and try again. It was giving me the same error and after it indexed the repository it ran like a charm

    0 讨论(0)
  • 2020-12-09 05:02
    1. This error would spring up arbitrarily and caused quite a bit of trouble though the code on my end was solid.

    I did the following :

    • I closed it on netbeans.
    • Then open the project by clicking "Open Project", selecting my project and
    • Simply hit the run button in netbeans.

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

    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.
    0 讨论(0)
  • 2020-12-09 05:02

    I faced the same issue. When I tried to run the project from IDE, it was giving me same error. But when I tried running from the command prompt, the project was running fine. So it came to me that there should be some issue with the settings that makes the program to Run from IDE.

    I solved the problem by changing some Project settings. I traced the error and came to the following part in my pom.xml file.

                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>exec</goal>                            
                    </goals>
                    <configuration>
                        <executable>${java.home}/bin/java</executable>
                        <commandlineArgs>${runfx.args}</commandlineArgs>
                    </configuration>
                </execution>
    

    I went to my Project Properties > Actions Categories > Action: Run Project: then I Set Properties for Run Project Action as follows:

    runfx.args=-jar "${project.build.directory}/${project.build.finalName}.jar"
    

    Then, I rebuild the project and I was able to Run the Project. As you can see, the IDE(Netbeans in my case), was not able to find 'runfx.args' which is set in Project Properties.

    0 讨论(0)
提交回复
热议问题