Maven 如何防止javafx程序中的依赖项解包
我在Netbeans中创建了一个新的Maven JavaFX程序(我是JavaFX新手)。默认的POM尝试将依赖项解压缩到Maven 如何防止javafx程序中的依赖项解包,maven,netbeans,javafx,Maven,Netbeans,Javafx,我在Netbeans中创建了一个新的Maven JavaFX程序(我是JavaFX新手)。默认的POM尝试将依赖项解压缩到/target/classes目录 这很烦人,因为我有一些很大的依赖项(比如eclipse链接) 我尝试过使用copy dependencies,并排除了大的依赖项,但找不到类 为什么Netbeans要构建这个POM,JavaFX是否需要解包依赖项(对于FXML等) 4.0.0 自动化 例如:自动化 1.0-快照 例如:自动化 自动化系统 1.0-快照 罐子 自动化系统
/target/classes
目录
这很烦人,因为我有一些很大的依赖项(比如eclipse链接)
我尝试过使用copy dependencies
,并排除了大的依赖项,但找不到类
为什么Netbeans要构建这个POM,JavaFX是否需要解包依赖项(对于FXML等)
4.0.0
自动化
例如:自动化
1.0-快照
例如:自动化
自动化系统
1.0-快照
罐子
自动化系统
UTF-8
示例.automation.Application
src/main/java
**/*.fxml
**/*.css
src/main/resources
**/*.xml
org.apache.maven.plugins
maven依赖插件
2.6
解包依赖项
准备包装
解包依赖项
系统
junit,org.mockito,org.hamcrest
${project.build.directory}/classes
复制依赖项
包裹
复制依赖项
${project.build.directory}/classes
org.codehaus.mojo
execmaven插件
1.2.1
解包依赖项
包裹
执行官
${java.home}/./bin/javafxpacker
-createjar
-nocss2bin
-应用类
${mainClass}
-srcdir
${project.build.directory}/classes
-奥特迪尔
${project.build.directory}
-外锉
${project.build.finalName}.jar
默认cli
执行官
${java.home}/bin/java
${runfx.args}
org.apache.maven.plugins
maven编译器插件
3.1
1.8
1.8
${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar
org.apache.maven.plugins
maven surefire插件
2.16
${java.home}/lib/jfxrt.jar
org.apache.maven.plugins
maven jar插件
3.0.2
真的
类/库/
sotec.supervision.automation.Application
sotec.supervision.automation
自动化模型
1.0-快照
sotec.supervision.automation
自动化modbus
1.0-快照
在pom.xml中,找到以下代码:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>prepare-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>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
org.apache.maven.plugins
maven依赖插件
2.6
解包依赖项
准备包装
解包依赖项
系统
junit,org.mockito,org.hamcrest
${project.build.directory}/classes
复制依赖项
包裹
复制依赖项
${project.build.directory}/classes
请查找元素名称
只需添加groupId名称,您可以在
下找到它
groupId名称应该用逗号(,)分隔。如果有人有同样的问题,也许我在这里的回答可以帮助。。。?
<?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>
<parent>
<artifactId>Automate</artifactId>
<groupId>example.automate</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>example.automate</groupId>
<artifactId>Automate-sys</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Automate-sys</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>example.automate.Application</mainClass>
</properties>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>prepare-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>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<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.8</source>
<target>1.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>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>classes/lib/</classpathPrefix>
<mainClass>sotec.supervision.automate.Application</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>sotec.supervision.automate</groupId>
<artifactId>Automate-model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>sotec.supervision.automate</groupId>
<artifactId>Automate-modbus</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>prepare-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>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>