My pom.xml file has two profiles which must delete and copy files in a
place. If I want the war for production, I need the log4j_prod.xml and if I
want the war for test I need the log4j.xml file. I show the test profile:
<profiles>
<profile>
<id>test</id>
<build>
<resources>
</resources>
<filters>
</filters>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete file="${project.build.outputDirectory}/log4j.xml" />
<delete file="${project.build.outputDirectory}/log4j_prod.xml" />
<copy file="src/main/resources/log4j.xml"
tofile="${project.build.outputDirectory}/log4j.xml" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>test</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Then I go to Run as --> Run configurations and I create a new Maven build
with these options:
Base directory: I select the project root
Goals: package
Profiles: test
And when I execute, in target classes the file tasks are done, but inside
the war file both log4j xml files are copied.
Any help, please?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]