I am trying to filter a properties file in src/main/resources for testing only with a mock. Next revert back to filtering for the real class.
This is my setup:
src/main/resources/META-INF/ejb-jar.xml
in ejb-jar.xml
...
<ejb-link>${ejb.link.class}</ejb-link>
</ejb-local-ref>
src/main/resources/config.properties
in config.properties: ejb.link.class = Mock
pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
<id>filter-resources</id>
<phase>process-resources</phase>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>src/main/resources/config.properties</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
In this example, this works fine for normal build. I would like to have a different filter for testing. Perhaps pull from src/test/resources, and when testing is done, the normal cycle is ran with the needed filter for production.
I can't seem to figure out the right sequence for execution for testing.
Any advice is appreciated.
Thanks,
Abe
Aucun commentaire:
Enregistrer un commentaire