I have a Maven project with several modules, with a structure similar to:
project
module-1
pom.xml
module-2
pom.xml
..
module-N
pom.xml
pom.xml
I have defined the Artifactory Maven plugin in the parent pom.xml which is under project, like it is done in the examples they offer on their website and I've also tried the example they have in git.
My problem is that I don't want to publish to Artifactory all the artifacts generated by the parent pom, but only those under certain modules, so I tried defining the plugin in the parent pom with the tag <publishArtifacts>false</publishArtifacts> and then defining the plugin again on the modules which contain artifacts I really do want to deploy with <publishArtifacts>true</publishArtifacts>, however no artifact is deployed.
If I try the other way, only specifying I do not want to publish Artifacts on the modules I don't, it does deploy all ignoring that configuration.
How should this be done using this plugin?
You can use the publisher\excludePatterns in the artifactory plugin section of the pom.xml to exclude artifacts from being published.
you can declare multiple patterns with wildcards, and separate each with a comma.
For example, if you are using the sample from
"https://github.com/JFrogDev/project-examples/tree/master/artifactory-maven-plugin-example"
then, setting you're pom with
<excludePatterns>multi3*.war,multi2*.jar</excludePatterns>
would exclude those files from being published to Artifactory.
hope that helps...
Related
I have a big local maven project that contains multiple modules which are inturn maven projects and are dependent on one another.
Ex.
parent pom.xml
<pom>
<module1> #jar
<module2> #dependent_on_module1.jar
<module3> #
</pom>
I have mentioned the sequence to build those modules in the parent pom.xml .
I also mentioned where to place the artifacts when they're built in groudId and artifactId.
But in the dependencies for all those modules, I have mentioned a common local system path for all those modules.
Is there any way to copy all the artifacts which are being created for modules when maven build is performed on the parent pom to a specific directory that can be dynamically mentioned when the maven command is run.
I have searched for maven copy command. But looks like it's not going to do what I want.
Any suggestions?
Is there a simple way to have gradle automatically generated a pom file listing the jar dependencies (both to published jars of other sibling projects and external) and have it included in the jar and published to a maven repo?
There is a lot of documentation on this subject but I am either missing something or it is as complicated as it seems. Can this not be done automatically?
I have the following maven structure in a multi-module project:
aggregator-level-0
-- module-level-1 (jar)
-- aggregator-level-1
---- module-level-2.1 (jar)
---- module-level-2.2 (jar)
The aggregator-level-0 pom is not only an aggregator but also the parent (inheritance) for the rest of the modules. It includes a DependencyManagement section.
The module-level-1 includes the module-level-2.1 as a runtime dependency, so I have added module-level-2.1 in the DependencyManagement section of the aggregator-level-0 pom.
When I build the project locally (maven 3.0.4), using the -o option and having my m2 local repository empty, everything works like a charm. Maven resolves perfectly the order to build the modules and deploys the artifacts well.
When I do the same in "jenkins" the build fails. It tries to get the module-level-2.1 when the dependency Management section in the parent pom is parsed, and of course it fails because it is not created/published yet.
Is this the expected behavior?
Do Maven and Jenkins get the dependencies at a different time?
Is it a bad practice to put in the dependency management section of a pom artifacts which will be built in a sub-module inheriting from that pom?
I created a pom.xml which contains my general dependencies. I want to add this pom into our inhouse repository (Artifactory) and then want to use it in all of my maven modules pom files as defining .
I can install the parent pom.xml into M2 and use it successfully but after I deployed the parent pom into Artifactory other poms can't download parent pom from Artifactory. I am sure that my inhouse repository settings are correct in settings.xml.
Is there a success way for this purpose?
Thanks in advance...
I'm trying to set up maven to build my project in the specific way. I have the following structure:
pom.xml
module1
pom.xml
module2
pom.xml
module2.1
pom.xml
module2.2
pom.xml
module2.3
pom.xml
I actually want to build separate rpms based on module1, module2.2 and module2.3 and want all these rpms be included into root one. Could, please, anybody help me with that if there is any ways to do this using maven and it's plugin only. Also I want this to be done via profiles, if it's possible. All my tryings led me to nothing.
Thanks in advance!
It looks like you need the maven-assembly-plugin. You should use it and define <moduleSets/> in your assembly descriptor.