java - Maven deploy two jars with different classifiers from two separate pom.xml -
i want deploy 2 jar artifacts different classifiers, @ moment fails because both supply own version of pom.xml
. how can fix that, both pom.xml
s can uploaded along artifacts?
example - have com.test.company.somelib-1.0.0-cmp1.jar
, com.test.company.somelib-1.0.0-cmp2.jar
, cmpx
classifier. both packages contain (logically) same code , classes (of same version), differ in way preprocessed. classifier annotation there due backwards compatibility need maintain.
long story short, first artifact uploads fine, second 1 fails forbidden
, because our repository not allow overwriting artifacts (and want keep way).
there different pipeline creates both packages, easier have builds separate. want deploy them 2 packages of same name , different classifier.
thanks help
edit: has been suggested use maven profiles. can see work, not ideal.
consider setup have depicted on picture below - there ci server (teamcity).
- there "starter" build (sources). build checkouts required source files.
- from starter build several other builds triggered (processing using x.x.x/compile). each of builds adjusts template-pom.xml (fills in particular
classifier
, other info), , builds , deploys artifact our artifactory.
with setup want achieve if decide add processing-build, need add "branch". if using profiles, need add new profile pom.xml file.
correct me if wrong please. profiles seem able achieve goal, not ideally, @ least in case.
i discourage having 2 (or more) different pom files same gav.
but understand need raised legacy reasons. have not tried myself working: leave 1 build (= maven project) have now. on other build skip normal deployment , manually invoke deploy-file goal of deploy plugin so:
<build> <plugins> <!-- skip normal execution of deploy plugin --> <plugin> <artifactid>maven-deploy-plugin</artifactid> <executions> <execution> <id>default-deploy</id> <configuration> <skip>true</skip> </configuration> </execution> </executions> </plugin> <!-- invoke goal: deploy-file --> <plugin> <artifactid>maven-deploy-plugin</artifactid> <executions> <execution> <id>someid</id> <phase>deploy</phase> <goals> <goal>deploy-file</goal> </goals> <inherited>false</inherited> <configuration> <file>path-to-your-artifact-jar</file> <generatepom>false</generatepom> <artifactid>xxx</artifactid> <groupid>xxx</groupid> <version>xxx</version> <classifier>xxx</classifier> <packaging>xxx</packaging> </configuration> </execution> </executions> </plugin> </plugins> </build>
Comments
Post a Comment