-1

私は現在、特定のプロジェクト構造に取り組んでいます。

project\WEB-INF\libターゲット フォルダーに WAR を作成する準備ができている内部のすべての jar ファイルをにコピーする必要があります。project\lib

実際の WAR が作成される前にトリガーされる maven-antrun または maven-resource プラグインを使用して、そのようなスクリプトを実行できますか?

はいの場合、どのようにプログラムしますか? ファイルは移動するのではなく、コピーする必要があります。

編集

次のxmlを使用して問題なく動作するソリューションを考え出しました。この構造はopenfireプラグインに必要です

残念ながら、2回目のmvn package実行時にのみ発生します

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.hpe.sis</groupId>
  <artifactId>TestCopy</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>TestCopy Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-core -->
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-core</artifactId>
        <version>1.19.1</version>
    </dependency>

  </dependencies>
  <build>
    <finalName>TestCopy</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/TestCopy/lib</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/target/TestCopy/WEB-INF/lib</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
4

1 に答える 1