Why I can't build jar in Maven

大兔子大兔子 提交于 2019-12-12 21:04:16

问题


Already I checked all the advice about similar problems. Nothing works. Maybe someone has an idea of what the problem is? Below pom file and console with an error.

<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>pezal2</groupId>
  <artifactId>pezal2</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>  
    <plugin>
        <groupId>com.zenjava</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>8.5.0</version> 
        <configuration>
        <mainClass>com.pezal.Main</mainClass>
        </configuration>
    </plugin>
    </plugins> 
  </build>
</project>

Console

   [ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.5.0:jar (default-cli) on project pezal2: Execution default-cli of goal com.zenjava:javafx-maven-plugin:8.5.0:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.5.0 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path C:\Program Files\Java\jre1.8.0_101/../lib/ant-javafx.jar -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

回答1:


The problem is that your JAVA_HOME links to JRE, not JDK. Try

mvn package -Djava.home="C:\Program Files\Java\jdk1.8.0_101"


来源:https://stackoverflow.com/questions/39735173/why-i-cant-build-jar-in-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!