pom.xml - How to set the Maven artifactId at runtime? -
i define artifactid in pom @ runtime. aware answers this question bad practise , maven archetypes should used instead, know if possible @ all.
currently have pom artifactid this:
<artifactid>myproject${var}</artifactid>
and can build project setting variable on command line:
mvn install -dvar=justatest
now possible change input variable @ runtime? example convert uppercase (e.g. gmaven-plugin) or similar?
you cannot change artifactid @ build-time. part of maven coordinates (groupid:artifactid:version) must fixed.
all other parameters change during build maven-antrun-plugin
.
<plugin> <artifactid>maven-antrun-plugin</artifactid> <version>1.8</version> <executions> <execution> <id>touppercase</id> <goals> <goal>run</goal> </goals> <configuration> <target> <property name="varupper" value="${var}"/> <script language="javascript"> <![cdata[ property = project.getproperty("varupper"); project.setproperty("varupper", property.touppercase()); ]]> </script> </target> <exportantproperties>true</exportantproperties> </configuration> </execution> </executions> </plugin>
after execution, maven have new property called ${varupper}
uppercased ${var}
. need set correct phase snippet above match build process.
Comments
Post a Comment