2017-08-28 43 views
0

我正在JAVAFX application上工作,我正在使用pom.xml文件,其中有依賴關係,它在我最後一臺計算機上運行良好,但是當我將它導入另一臺計算機而不是它給我一個錯誤時,無法執行maven plugin,我在互聯網上搜索,並遵循所有可能的解決方案,在那裏,但都不適合我。爲什麼我的java程序無法加載maven插件?

現在我有一個問題,爲什麼我得到這個未能加載maven插件的錯誤?

這裏是日誌跟蹤:

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

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. 

For more information about the errors and possible solutions, please read the following articles: 

這裏是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?> <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.viremp</groupId> 
<artifactId>EmployeeManagement</artifactId> 
<version>1.0</version> 
<packaging>jar</packaging> 

<name>EmployeeManagement</name> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <mainClass>com.viremp.employeemanagement.MainApp</mainClass> 
</properties> 

<organization> 
    <!-- Used as the 'Vendor' for JNLP generation --> 
    <name>VirEmp Technologies International</name> 
</organization> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>com.zenjava</groupId> 
      <artifactId>javafx-maven-plugin</artifactId> 
      <version>8.6.0</version> 
      <configuration> 
       <mainClass>com.viremp.employeemanagement.MainApp</mainClass> 
       <bundler>EXE</bundler> 
       <needShortcut>true</needShortcut> 
       <appName>Employee Management System</appName> 
      </configuration> 
      <executions> 
       <execution> 
        <id>create-jfxjar</id> 
        <phase>package</phase> 
        <goals> 
         <goal>build-jar</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>create-native</id> 
        <phase>package</phase> 
        <goals> 
         <goal>build-native</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <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/javapackager</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> 
       <execution> 
        <id>default-cli</id> 
        <goals> 
         <goal>exec</goal>        
        </goals> 
        <configuration> 
         <executable>${java.home}/bin/java</executable> 
         <commandlineArgs>${runfx.args}</commandlineArgs> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.1</version> 
      <configuration> 
       <source>8</source> 
       <target>8</target> 
       <compilerArguments> 
        <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath> 
       </compilerArguments> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.16</version> 
      <configuration> 
       <additionalClasspathElements> 
        <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement> 
       </additionalClasspathElements> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<dependencies> 

    <dependency> 
     <groupId>com.jfoenix</groupId> 
     <artifactId>jfoenix</artifactId> 
     <version>1.3.0</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <version>6.0.6</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang --> 
    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.6</version> 
    </dependency> 


</dependencies> 

在此先感謝!

+1

使用'-X'運行mvn以獲取有關錯誤的更多信息 – Jens

+0

您是否嘗試過運行> Maven使用目標進行安裝乾淨安裝? –

+0

不,我沒有試過 –

回答

0

我已經解決了這個問題,它實際上被扔,因爲在我的代碼,這是關係到MySQL其他一些構建錯誤的錯誤failed to execute,在這之前我的想法是讓我先解決這個plugin錯誤比我將刪除那個錯誤,但是當我沒有得到任何合適的答案時,比我想刪除其他錯誤,比我會回到這個並且會消除這個錯誤,但是當我移除了我的其他錯誤時,比發生了這個錯誤,並且所有的錯誤,MySQL以及plugin錯誤。

不知道爲什麼,但它爲我做了詭計。 不知道爲什麼通過刪除其他錯誤,也刪除了這個問題,這一切之間的關係是什麼。

+0

可能因爲現在主要課程已經可用。然後執行可以安全地運行javapackager。無論如何,你很好。 –

1

exec插件在路徑${java.home}/../bin/javapackager中執行二進制文件。

執行它時,它返回1的錯誤代碼,很可能是它找不到二進制文件。

檢查您是否擁有有效的JAVA_HOME並且存在javapackager。 也許你在新機器上有一個jre?

+0

好回答,但這不是我所面臨的問題。 –

相關問題