I've been searching around but I could not find the answer.
What I want is to download a pom.xml dependency, and execute some goals (profiles) against it.
I mean:
pom a -> mvn clean install -Psome
donwload the pom b and execute clean package -Panother
This is quite easy with the maven-exec plugin. And I already download the pom with the dependency plugin.
But I wonder if there is a specific plugin.
You could look at bootstrapping a maven project which is supported by maven scm plugin. This assumes you have the pom in an scm.
Related
Trying to download all maven dependencies for a complex project to speed up subsequent builds. There are some dependencies that are not outlined on pom.xml, such as com.apollographql.apollo:apollo-compiler which are triggered as part of the generate-sources phase (from a dependency I do include apollo-client-maven-plugin)
my original plan of using maven dependency:go-offline did not work because these jars are not included.
i'm currently using the work around maven dependency:go-offline generate-sources which ensure that those extra jars are downloaded, but now i have to wait for the actual generation of the sources...
Is there a way to just force maven to detect dependencies fully?
Alternatively, any way to have incremental mvn --offline, i.e. uses the jar locally without updating repository info, but do download missing ones?
i have a maven project which has some local artifacts as dependencies.
When I have to package my main application, i have to do a mvn install command on my local repositories before, which is quite annoying and easy to forget.
Is there a way to tell maven to install local repositories when packaging the main one?
One solution can be to wrap up all your components into a pom project.
When building a parent pom maven automatically triggers a build of all the sub-modules.
I cloned the git repository of Apache ActiveMQ Artemis project (https://github.com/apache/activemq-artemis) and then typed
mvn -Ptests test -pl :integration-tests
I was surprised to see log messages like the following
...
Downloading: http://repository.apache.org/snapshots/org/apache/activemq/artemis-selector/1.4.0-SNAPSHOT/artemis-selector-1.4.0-20160625.030221-11.jar
Downloading: http://repository.apache.org/snapshots/org/apache/activemq/artemis-core-client/1.4.0-SNAPSHOT/artemis-core-client-1.4.0-20160625.030211-11.jar
...
Since e.g. artemis-core-client is contained in the git repository I cloned in the beginning, I'd have expected maven just builds it from there.
That way, when I make changes in the core client source, they get picked up by the integration tests.
Instead, maven is downloading the jar from the repository.
Question: How do I configure maven to always build all modules that are in the git repository and download only "true" dependencies, which I mean things not in the git repository?
You are not executing the Maven build on the main project, on the main pom.xml which indeed defines the artemis-selector and artemis-core-client modules, among others.
You are executing the Maven build on the tests and its pom.xml, where only tests modules are defined. This is a side/test project, which has as parent the previous pom file, but it doesn't play any role in its parent modules definition. Hence, dependencies are not resolved as modules but as Maven dependencies.
You should firstly install (via mvn clean install) the former project, so that libraries will be available in your local Maven cache (hence no downloading would be triggered), then execute the tests project.
Check the Maven docs for a inheritance vs aggregation difference to further clarify it.
From the Stack Overflow, the follow threads could also be interesting:
What is the difference between using maven -pl option and running maven from module level?
Maven multi module project cannot find sibling module
I have issue with Project Building in Maven. I have updated some code in one of the dependency jars which is available in Maven Repository .I need to build my project with the jar i have modified.How to do that .Kindly Help me.
1. Install mvn project
Make sure to install your changed code into your repository.
Run following maven command for your updated library project.
mvn install
2. Check dependency
Check if the version of your library project match with the dependency entry in your main project pom.
E. g. if you install version "1.1" make sure the dependency entry is also "1.1"
I would like to know the maven command line to download the dependencies described in the pom.xml.
It is that : mvn dependency:copy-dependencies ?
Try the dependency:go-offline goal. It's meant to be used to resolve dependencies to the local repo before using the -o switch to go to offline mode. But the goal itself has no bearing on going offline. The name may be misleading.
Goal that resolves all project dependencies, including plugins and reports and their dependencies.
Here's the details about the dependency:copy-dependencies in case you're interested
Anther option is the dependency:resolve goal
Goal that resolves the project dependencies from the repository.