W want my maven project to produce three artifacts with different classifiers at once. I know that I can produce it with modules etc. This is actually a resources project th
This can be done without profiles if you specify multiple plugin executions and resource filtering.
Create a properties file for each version in ${basedir}/src/main/filters (e.g. prod.properties, dev.properties) holding appropriate values for each environment.
Turn on filtering for your resources:
src/main/resources
true
Now add the resource plugin executions. Note the different filter file and output directory.
org.apache.maven.plugins
maven-resources-plugin
default-resources
process-resources
resources
${project.build.outputDirectory}/dev
${basedir}/src/main/filters/dev.properties
prod
process-resources
resources
${project.build.outputDirectory}/prod
${basedir}/src/main/filters/prod.properties
Finally, the jar plugin; note classifier and input directory:
org.apache.maven.plugins
maven-jar-plugin
default-jar
package
jar
dev
${project.build.outputDirectory}/dev
jar-prod
package
jar
prod
${project.build.outputDirectory}/prod
Running mvn clean install should produce the properly filtered resources in artifacts with dev and prod classifiers like you want.
In the example, I used execution IDs of default-resources and default-jar for the dev versions. Without this you would also get an unclassified jar artifact when you build.