Java EE アプリケーションを Windows と Linux に配布する必要があります。アプリケーションには、WEB-INF/bin フォルダーにいくつかのシステム依存ファイル (dll など) があります。
私はこのアプローチを試みています。
プロジェクト フォルダ ツリーは次のようになります。
- プロジェクト
-- src
---- メイン
---- Java
------ webapp
-------- ...
-------- WEB-INF
------- ---- bin (現在は空のフォルダー)
-- ターゲット
すべての bin ファイルを次の場所に移動しました。
- プロジェクト
-- 配布
---- ビン
------ 勝利
------ linux
最初のステップで、Maven を構成して、distrib/bin/win をターゲット フォルダーの WEB-INF/bin にコピーしようとしています。
2 番目のステップでは、最初のプロファイルが機能したら、2 つのプロファイル (1 つは Windows 用、もう 1 つは 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が初めてなので、助けが必要です。