Pet*_*zov 5 javafx build maven-3 maven
我有一个基于 Maven 的 JavaFX 项目。我想在 Windows 和 Linux 上构建 Maven 项目。为了在部署捆绑包时自动化该过程,我想自动检测操作系统。
在 Windows 中我有这样的配置:
<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>
Run Code Online (Sandbox Code Playgroud)
但在 Linux 上我有这样的配置:
<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>/opt/java/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我可以根据部署包的操作系统以某种方式设置 Java 的使用吗?
您可以将配置文件用于此类目的,如下所示:
<profiles>
<profile>
<activation>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
</activation>
...
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5969 次 |
| 最近记录: |