Maven RPM Packaging After *.jar creation - maven

I researched everywhere, but could not find answer. My problem is that I would like to create my *.jar file with all its dependencies using the usual mvn install scheme. But once the *.jar is created, I like to package it using Mojo RPM plugin.
The problem is that Mojo RPM plugin is executed during mvn install lifecycle. However the *.jar is not created until after the install phase is complete. So when the rpm plugin runs, it will not have any *.jar to install.
How can we build, install the jar and then package it into an rpm using Mojo RPM plugin?

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?

<Maven> How is the command "mvn dependency:resolve" different from "mvn clean install"?

I would like to ask about the use of the command "mvn dependency:resolve". When I executed the command in project folder, it seems it download jars and build the application. I wonder if it has the same functions as "mvn clean install". Thanks.
Install will compile, test & package your Java project and even install/copy your built .jar/.war file into your local Maven repository.
But dependency:resolve compile your application and print resolved dependencies.

Maven install excluding specific modules

I am installing this project with several modules. The goal is to install all modules EXCEPT the nd4j-cuda module. If I run this:
mvn clean install -pl ':nd4j-cuda-8.0'
then maven attempts to install the module, no errors are thrown detecting it. However, since I actually do NOT want to install it, I tried
mvn clean install -pl '!:nd4j-cuda-8.0'
but I get the error message
Could not find the selected project in the reactor: !:nd4j-cuda-8.0
What am I doing wrong here?
I try with groupId:
mvn clean -pl '!org.nd4j:nd4j-cuda-8.0'
also
mvn clean -pl '!:nd4j-cuda-8.0'
give teh same result.
My maven version is: 3.3.3
With maven version 3.0.5 I have the same error as you, so please use newer version of maven.

How to install java library with its source code and javadoc to local repository by using maven

I have generated binary jar, source code jar and javadoc jar, but the "mvn install" only install the binary java, is there any easy way to also install source code jar and javadoc jar ? Thanks
The simplest way to achieve it is by using the performRelease flag
mvn -DperformRelease=true clean install
It will add sources and javadocs to the installed artifact

Error building hadoop 1.0.1 - missing pom.xml

I followed the instructions given here to download and build hadoop 1.0.1 from this repository. I have installed JDK, Maven, cmake, autoconf etc. When I run th efollowing command from the hadoop top level directory
mvn -e package -Pdist -Pdoc -Psrc -Dtar -DskipTests
mvn reports an error saying that no pom.xml is found. There is no pom.xml file in the folder or any subfolders.
As far as I investigate the Hadoop Common tags, only version 0.23.x and 2.0.x is a Maven project. The rest is an Ant and/or Ivy project. Please note If there is no pom.xml it is not a Maven project.
If you would like to build the version 1.0.1, please use Apache Ant or Apache Ivy instead.

Resources