为什么我不能在Maven中构建jar [英] Why I can't build jar in Maven

查看:225
本文介绍了为什么我不能在Maven中构建jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经检查过有关类似问题的所有建议。什么都行不通。也许有人知道问题是什么? pom文件和控制台下面有错误。

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>

控制台

   [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


推荐答案

问题是您的JAVA_HOME链接到JRE,而不是JDK。试试

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"

这篇关于为什么我不能在Maven中构建jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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