英文:
replacing file into WAR file which is generated by mvn package
问题
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>target/Project-xyz/classes/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java/resources/customers</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
英文:
i have a maven project and i want when using clear package
maven command to replace config file from source code and replace it with exciting one in the WAR.
i tried but the replacing only happens in extracted folder not WAR file
this is my pom.xml
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>target/Project-xyz/classes/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java/resources/customers</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
答案1
得分: 0
经过多次尝试,通过以下方式使其工作:
> org.apache.maven.plugins
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp/resources/customer1/css</directory>
<targetPath>resources/css</targetPath>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
英文:
after so many trials it worked by using
> org.apache.maven.plugins
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp/resources/customer1/css</directory>
<targetPath>resources/css</targetPath>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
专注分享java语言的经验与见解,让所有开发者获益!
评论