我必须将Java EE应用程序分发到Windows和Linux。应用程序在WEB-INF/bin文件夹中有几个系统相关文件(DLL等)使用Maven在战争中包含系统相关二进制文件
我正在尝试这种方法。
项目文件夹树是这样的:
- 项目
- SRC
----主要
---- Java的
------ web应用
-------- ...
-------- WEB-INF
----------- bin(现在是空文件夹)
- 目标
我已经感动了所有的bin文件到:
- 项目
- DISTRIB
----斌
------赢得
----- - linux的
在第一步我想配置Maven复制DISTRIB /斌/赢到WEB-INF/bin中的目标文件夹中
第二步,当第一步工作时,我将为windows添加两个配置文件,另一个用于linux。
在我的pom.xml中,我已经把这些行:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>distrib/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
在这里,你有bin.xml来源:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd" >
<id>webtop10.2_bin</id>
<fileSets>
<fileSet>
<directory>${project.build.directory}/distrib/bin/win</directory>
<outputDirectory>/WEB-INF/bin</outputDirectory>
<includes>
<include>*.*</include>
</includes>
<fileMode>0750</fileMode>
<directoryMode>0755</directoryMode>
<lineEnding>keep</lineEnding>
</fileSet>
</fileSets>
</assembly>
当我执行MVN包构建成功,但这些文件不会复制到WEB-INF/bin文件夹中。汇编插件说:
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (distro-assembly) @ sibila ---
[INFO] Reading assembly descriptor: distrib/bin.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
我是新的Maven,所以我需要帮助。
感谢这是一个完美的解决方案形式我的问题。最好的问候 – user1806859
@ user1806859太好了。如果你也提出了我的答案,我会满足你的问题。 – maba