Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Deploy only the sub-modules using maven deploy?

Tags:

maven

How do i deploy only the sub-modules of the project? i have a project as;

ProjectA
 -  Submodule B
 - Submodlue C
 - Submodule D 

The submodules are packaged as jar and is deployed to maven repo.how can only the sub -modules be deployed to the maven repository and not the main project?

like image 976
Nazia Avatar asked Sep 16 '11 14:09

Nazia


People also ask

How do I skip a Maven build module?

Maven version 3.2. 1 added this feature, you can use the -pl switch (shortcut for --projects list) with ! or - (source) to exclude certain submodules. Be careful in bash the character ! is a special character, so you either have to single quote it (like I did) or escape it with the backslash character.

What is the use of mvn deploy command in Maven?

The mvn deploy runs the deploy plugin which deploys an artifact to the remote repository. A project may include the main jar and associated sources and Javadoc jars. The sources jar contains the Java sources, and the Javadoc jar contains the generated Javadoc.

Can we deploy using Maven?

The maven deploy plugin can be used to deploy either files or projects to the remote repository for sharing it with other developers and projects. There are various methods can be used to deploy your artifact to the remote repository by using a maven deploy plugin.


2 Answers

Put this in module(s)(or module's pom.xml) that you don't want to deploy:

<properties>
  <maven.deploy.skip>true</maven.deploy.skip>
</properties>

Since this is inherited by submodules, you have to put this in submodules that you do want to deploy:

<properties>
  <maven.deploy.skip>false</maven.deploy.skip>
</properties>
like image 91
vishwambhar Avatar answered Oct 17 '22 07:10

vishwambhar


Another suggestion could be doing the following:

mvn deploy -pl SubModuleB
like image 14
daemon_nio Avatar answered Oct 17 '22 05:10

daemon_nio