我有一個使用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