maven pom 设置outputDirectory,maven-antrun-plugin,maven-resources-plugin
薛坚
2023-12-01
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<outputDirectory>target/A/lib/classes</outputDirectory>
</build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>createThriftDir</id>
<phase>process-resources</phase>
<configuration>
<tasks>
<mkdir dir="target/A"/>
<mkdir dir="target/A/bin"/>
<mkdir dir="target/A/data"/>
<mkdir dir="target/A/lib/classes/com/a/b/c/d/e"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}/target/A/bin</outputDirectory>
<resources>
<resource>
<directory>bin</directory>
</resource>
</resources>
</configuration>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
<execution>
<id>copy-resources2</id>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}/target/A/data</outputDirectory>
<resources>
<resource>
<directory>data</directory>
</resource>
</resources>
</configuration>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
<execution>
<id>copy-resources3</id>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}/target/A/lib</outputDirectory>
<resources>
<resource>
<directory>lib</directory>
</resource>
</resources>
</configuration>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
</executions>
</plugin>