我有一个使用Hibernate ORM并具有Maven的JavaFX项目。每当我运行我的项目时,我必须等待其运行时间,因为Maven会继续解包Hibernate依赖项。这是必不可少的?或者我可以关闭它,为什么不得不一遍又一遍地打开所有东西,而不是一次?日志看起来是这样的:如何阻止Maven在每个项目运行时解包
--- Maven的依赖关系的插件:2.6:解开依赖性(解压依赖性)@ SeedCalendar --- 开箱C:\用户\ maurice.m2 \库\组织\ hibernate \ javax \ persistence \ hibernate-jpa-2.1-api \ 1.0.0.Final \ hibernate-jpa-2.1-api-1.0.0.Final.jar到C:\ book \ SeedCalendar \ target \ classes with includes“ “并且不包括”“ 将C:\ Users \ maurice.m2 \ repository \ org \ hibernate \ hibernate-core \ 5.2.9.Final \ hibernate-core-5.2.9.Final.jar解压到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 开箱C:\ Users \ maurice.m2 \ repository \ org \ javassist \ javassist \ 3.20.0-GA \ javassist-3.20.0-GA.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” Un打包C:\ Users \ maurice.m2 \ repository \ antlr \ antlr \ 2.7.7 \ antlr-2.7.7.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 解包C: \ Users \ maurice.m2 \ repository \ com \ fasterxml \ classmate \ 1.3.0 \ classmate-1.3.0.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 开箱C:\ Users \ maurice.m2 \ repository \ dom4j \ dom4j \ 1.6.1 \ dom4j-1.6.1.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 开箱C:\ Users \ maurice .m2 \ repository \ org \ jboss \ jandex \ 2.0.3.Final \ jandex-2.0.3.Final.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 开箱C:\ Users \ maurice.m2 \ repository \ org \ jboss \ logging \ jboss-logging \ 3.3.0.Final \ jboss-logging-3.3.0.Final.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” 开箱C:\ Users \ maurice.m2 \ rep ository \ org \ jboss \ spec \ javax \ transaction \ jboss-transaction-api_1.2_spec \ 1.0.1.Final \ jboss-transaction-api_1.2_spec-1.0.1.Final.jar到C:\ book \ SeedCalendar \ target \包含“”的类并排除“” 开箱C:\ Users \ maurice.m2 \ repository \ org \ hibernate \ common \ hibernate-commons-annotations \ 5.0.1.Final \ hibernate-commons-annotations-5.0.1 .Final.jar到C:\ book \ SeedCalendar \ target \ classes with includes“”并排除“” --- exec-maven-plugin:1.2.1:exec(unpack-dependencies)@ SeedCalendar --- javafxpackager .exe已被重命名为javapackager.exe。 原始文件可能会在将来的版本中被删除以代替javapackager。 请更新您的脚本。
我POMfile看起来是这样的:
<?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.hibernate</groupId>
<artifactId>SeedCalendar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SeedCalendar</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.hibernate.seedcalendar.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>
<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>1.7</source>
<target>1.7</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>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.9.Final</version>
谁能告诉我一步一步如何把这个恼人的功能关闭,是否会有任何不良后果什么时候关闭自动解包模式?
谢谢!
因为不是maven内置的行为 - 这是你的构建(解包 - 依赖性执行)明确要求的 - 所以问题是为什么你的构建需要这样做呢? – radai
我不知道,我偶然篡改了POM文件,我自己让Netbeans创建了一个标准的JavaFX Maven项目。我应该删除哪部分以便进行拆箱大屠杀? – Maurice
这个问题只是基于对Maven概念的误解......但是开始尝试编写脚本......这导致了简单的糟糕构建...解压缩依赖关系在大多数情况下表明了这样的情况误解......最好是使用exec:java目标exec-maven-plugin,因为它已经在类路径中全部重复了...所以...要清理它,你需要完全理解整个构建,比你可以清理它...并使其正确工作... – khmarbaise