Can I split dependency resolution in maven into separate command? - maven

I want to split a mvn install command into 2 separate ones - dependency resolution and build itself, like it can be done in NPM (with npm run ci and npm run webpack separately). The reason to do so is to measure how much time is spend on dependency resolution and how much on build itself.
I have tried to use mvn dependency:go-offline with mvn install -o afterwards. According to docs this is exactly what I need, however it does not work. Plugin dependencies are not downloaded (mentioned in pom file under build/plugins).
Can this goal be achieved somehow?

Indeed, it seems the dependency:go-offline standard goal is not "perfect" as some plugins may still trigger some (re)downloading during the mvn package phase.
(I had noticed this when looking at this SO question about how to optimally rely on Docker's cache.)
To fix this, you can try mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies after installing the corresponding plugin mentioned in this SO answer by #user2813807.

Related

mvn install running before package

So I have a parent maven project with a few child modules. All child projects generate jars and have dependencies. As part of the package phase, following are done
Compiled jars are copied to a lib directory
Dependencies are copied to a extlib directory
A tar.gz package is created in the end (I am worried about the order as assembly is done in parent while copy is done in child project poms)
Once packaging is complete, I want to install the package on a remote server, so I have then antrun plugin which takes care of it, inside install phase.
The problem is that I cannot control the order in which things are done. I would like to keep the responsibilities separate but if I run the command: mvn clean package install, it will run the install phase first which I think is because it is part of parent pom deployment which is done first. I have to run it in two commands i.e. mvn clean package and then mvn install to make sure latest is deployed.
Is there anyway to run this install phase at the end when packaging is done?

BUILD FAILURE while installing DL4J

I'm trying tu buld projetct with DL4J .
I did the following steps from ths website : https://deeplearning4j.konduit.ai/getting-started/quickstart
When I do this command mvn clean install
I get the following error :
It looks like you modified something? Sorry if I'm not quite following what you did, but that error message indicates a missing pom.xml.
The specific steps you follow are:
Clone the repository
git clone https://github.com/eclipse/deeplearning4j-examples
cd in to the directory
cd deeplearning4j-examples/dl4j-examples
Run mvn clean install -DskipTests
mvn clean install -DskipTests
What I think could have happened here is you were in the root of the project. The deeplearning4j examples actually do not have a root pom.xml. We used to, but that took too long for people just getting started.
Of note here as well is another submodule in the project:
https://github.com/eclipse/deeplearning4j-examples/tree/master/mvn-project-template
This contains the default getting started project.
The dl4j-examples contain samples for different use cases. Please pay attention to that when looking at both.
Hopefully this helps!

'ng add #nguniversal/express-engine' not working

I am learning about angular universal. At this step :
ng add #nguniversal/express-engine --clientProject angular.io-example
It is supposed to add some files namely : main.server.ts, but it is not doing anything. I tried the same command with sudo too. What is the problem?
FYI, I started off with a clean project so there indeed were dependencies missing, your case might be a bit different, depending on whether you already have some of the dependencies already installed.
Since it was doing the same for me too as mentioned, I went ahead and used
npm i #nguniversal/express-engine
which showed me some warnings about some dependencies which were missing.
In my case they were,
npm install ajv-keywords
and
npm install #angular/platform-server
then I ran
npm install #nguniversal/express-engine
to install the package, then
ng add #nguniversal/express-engine
which added the necessary dependencies you were asking for. Hope this is easy to follow

Fast way to rebuild and reload opendaylight bundle

I am developing a bundle for opendaylight. Is there a quick way to just rebuild the bundle without the complete karaf environment?
Thanks in advance!
Max
You can rebuild the bundle, without anything else, by running Maven in the directory containing your bundle’s POM. If you’re on the command-line:
cd your-bundle-directory
mvn compile
(or mvn install etc. depending on what you want to do exactly).

Maven: non lifecycle-related goal

I have project for which you need to have a few dependency downloadable from an internal repo.
If this is not possible I'd like to provide an option to install the deps locally (using maven-install-plugin).
Point is: since this is fully optional I do not want this to be part of the regular lifecycle (I've seen solutions where the install plugin is executed in the clean phase). Which is the terser and more elegant way to provide an option to install prerequisites locally?

Resources