Is it possible to avoid deploying the artifact that is built according to the project packaging during 'deploy:deploy' processing?
I mean the following:
suppose we have a 'pom.xml' for web application and define packaging type as 'war';
we want to assemble either '*.war' artifact or '*.zip' that contains our application as well as a servlet container;
we want to deploy only that '*.zip' artifact during 'deploy:deploy' processing;
I.e. I want to be able to run 'mvn deploy' and has the following results:
'myapp.war' is constructed;
'myapp-standalone.zip' is constructed;
'myapp-standalone.zip' is deployed to the target remote repository (note that I don't bother if 'myapp.war' is installed to the local repository here);
I checked 'war:war documentation' and found 'primaryArtifact' parameter. However, it mentions only local repository.
I tried the following POM but it still deploys either '*.war' or '*.zip' to remote repository:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mygroup</groupId>
<artifactId>myapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>myapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- dependencies go here -->
</dependencies>
<build>
<plugins>
<! -- plugins like 'compiler' etc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<primaryArtifact>false</primaryArtifact>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>myapp-standalone</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/standalone.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<-- target repository information -->
</repository>
<snapshotRepository>
<-- target repository information -->
</snapshotRepository>
</distributionManagement>
</project>
It seems that I can get desired behavior via declaring project packaging as 'pom' and manually configuring all mojos implied by 'war' packaging ('resources:resources', 'compiler:compile', 'resources:testResources', 'compiler:testCompile', 'surefire:test', 'war:war', 'install:install', 'deploy:deploy'). However, that would make the POM rather verbose and I'd like to avoid that.
As far as I understand, Maven way is to always have an artifact implied by project packaging type as a one of project artifacts. But it's not clear what Maven user is expected to do if he or she wants to get an artifact that is not matched to any default packing types (e.g. single '*.zip' archive).
Any thoughts?
Regards, Denis
According to the Maven Deploy Plugin documentation:
deploy:deploy is used to automatically install the artifact, its pom and the attached artifacts produced by a particular project. [...]
So I don't think it's possible to prevent your war from being deployed "as is".
However, to obtain the desired effect, you could add a specific module to your build that would be in charge of producing the assembly (the assembly would depend on the war module) and configure the deploy plugin in the war module to skip deployment as follows:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>X.Y</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
Related
I have a Java code in which I added JARs using Maven and also from the local system. Now as I am running it on a different system, the local JARs are missing. How can I add everything to Maven and remove the local class paths?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.memeanalytics</groupId>
<artifactId>kafka-consumer-storm</artifactId>
<packaging>jar</packaging>
<version>1.1.0</version>
<name>HibernateExample</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>github-releases</id>
<url>http://oss.sonatype.org/content/repositories/github-releases/</url>
</repository>
<repository>
<id>clojars</id>
<url>http://clojars.org/repo</url>
</repository>
<repository>
<id>cloudera-repo-releases</id>
<url>https://repository.cloudera.com/artifactory/repo/</url>
</repository>
</repositories>
<dependencies>
<!-- <dependency> <groupId>net.wurstmeister.storm</groupId> <artifactId>storm-kafka-0.8-plus</artifactId>
<version>0.4.0</version> </dependency> -->
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.1.3</version> <!-- was 1.1.0-M3 -->
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-kafka</artifactId>
<version>0.9.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.sd.dwh.kafka.storm.Invoker</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I don't know what you mean by "local JARs". If you mean a mixture of Maven dependencies and manually added JARs into the IDE, then this is a very bad idea. Either you use Maven or not. If you use Maven, everything should be a Maven dependency. In future, you need every manually added jars to be managed by Maven by adding it into the local repository:
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
After you added it into the local repository, you can add it as dependency in your pom.xml as you do with all other dependencies from Maven central.
If you share the project with other people or other computers, you run into the problem you were talking about. In a team (or inside a local network), you usually run a repository manager like Nexus. When there are new dependencies which were manually added (and installed to the local repository) you usually deploy it to Nexus which acts as a proxy between your local network and Maven central. Then, everybody in your team or local network can find these dependencies.
The easiest attempt to fix is to:
1. Take note of all the jars/dependencies that you added manually to the classpath (using your IDE or otherwise)
2. Use maven central search facilities (http://search.maven.org/) to locate those dependencies (one by one, of course) in public repositories. The results you find using online maven searches will include a snippet of the pom for those dependencies (<dependency>...</dependency>). Copy and paste them into your existing pom.xml's dependencies section.
3. Remove your IDE-based classpath entries.
Of course, this can only work if those dependencies are in public repositories.
You can setup a maven repository manager like nexus for your local development which can proxy the maven central repository and you can deploy your own library in it. And when you need to develop on another environment, you can get the dependencies from your local maven repository.
I have a project with a standard pom and jar packaging.
The standard -.jar is a desirable artifact of this project.
Additionally to the standard jar with all the classes of this project i need to create an additional jar only with the enums declared on it.
If i am abble to generate this jar in a maven standard with a different artifactId would be a plus.
This question here Create several jar files from single project using maven would be a good starting point but there is no answer
Any ideas?
Your best bet is to have a Maven multi-module build.
Typically, this consists of a single parent module plus multiple child modules.
The packaging of the parent module should be "pom" and it will only act as a container of the child modules.
The parent's pom.xml will look something like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your groupID</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Name</name>
<modules>
<module>submodule1</module>
<module>submodule2</module>
</modules>
</project>
Each module should be the name of a subdirectory. These subdirectories will contain their own pom.xml files.
Note that the groupId, artifactId, and version will be used later, so they should be something meaningful.
Your two child modules should look like normal jar packaging POM files with a few exceptions:
Each module should have a <parent> element points to the <groupId>, <artifactId>, and <version> of the parent module. While this section isn't strictly necessary, it does let you define common dependencies in the parent module.
The regular module will have the enum module as a dependency. You declare this just like any other dependency, but be aware that Maven compiles modules in order, so the enum module should be in the parent pom first.
I suggest you break your classes into two maven artifacts: one with the Enums and Interfaces as a dependency of the other which has your implementations. Since each has it's own POM you'll get two jars out of a build.
I end up using profiles to manage the solution solution. One managing the maven-jar-plugin plugin and other for the maven-source-plugin.
<profiles>
<profile>
<id>enum</id>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classifier>enum</classifier>
<includes>
<include>**/*Enum**</include>
<!-- or any other way to math my artifacts -->
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>enum-sources</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${mavenSourcePluginVersion}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<configuration>
<classifier>enum-sources</classifier>
<includes>
<include>**/*Enum**</include>
<!-- or any other way to math my artifacts -->
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
In this way i can use
mvn install -Penum
to generate the jars with only the enums
and
mvn install -Penum-sources
to generate the jars with the sources.
to include this dependencies in other maven projects all you need is to specify the profile with classifier as in
<dependency>
<groupId>${groupId}</groupId>
<artifactId>{artifactId}</artifactId>
<version>${version}</version>
<classifier>enum</classifier>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>{artifactId}</artifactId>
<version>${version}</version>
<classifier>enum-sources</classifier>
</dependency>
I am developing an eclipse plugin which needs an com.lmax.disruptor.It imports sun.misc. I have this in my p2 repository but when I maven build my plugin I am getting this error "unable to satisfy dependency from com.lmax.disruptor 3.2.0 to package sun.misc 0.0.0."
I have gone through the sites Resolve a dependency on package sun.misc with Tycho they are saying to create a plugin fragment but when I tried to create it and added export page as sun.misc, It is throwing an error like "package sun.misc doesnot exsist in the plugin".
How can solve this issue please help me with this.? Instead of creating new plugin fragment,is there is any possible way i can add in my plugin itself ?
Thanks,
As mentioned in oberlies' answer in the question you link to, you need to build a system bundle fragment, which exposes, i.e., exports, the sun.misc package. I don't know of any other way. However, this is easier than could be expected.
You do this by creating an OSGi MANIFEST.MF that exports sun.misc, and then bundle it into a fragment. This is done via Maven as follows.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.group</groupId>
<version>1.0.0</version>
<artifactId>your.group.fragment.sun.misc</artifactId>
<packaging>jar</packaging>
<name>System Bundle Fragment exporting sun.misc</name>
<description>This bundle extends the System Bundle export list with the sun.misc package such that OSGi bundles may refer to Sun's misc implementation without the OSGi framework itself to provide it in a non-portable way.</description>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<forceCreation>true</forceCreation>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Export-Package>sun.misc</Export-Package>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.4</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-Category>your.group</Bundle-Category>
<Fragment-Host>system.bundle; extension:=framework</Fragment-Host>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run mvn clean install on this POM. Now you need to make the fragment consumable for Tycho, i.e., you need to make it available via a p2 Software Site.
Thankfully there is a great Maven plugin which can help with that: reficio's p2-maven-plugin. You can use it to basically wrap any mavenized JAR into an OSGi bundle and then provide it via a p2 site.
Set up the respective POM as follows.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sun-misc-p2</groupId>
<artifactId>site</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.reficio</groupId>
<artifactId>p2-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifacts>
<!-- specify your depencies here -->
<!-- groupId:artifactId:version -->
<artifact><id>com.lmax:disruptor:3.3.2</id></artifact>
<artifact><id>your.group:your.group.fragment.sun.misc:1.0.0</id></artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.5.v20120716</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
<webApp>
<contextPath>/site</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</pluginRepository>
</pluginRepositories>
</project>
Note that I use this plugin to provide the LMAX Disruptor (version 3.3.2, the latest one at the time of writing, is thankfully available from Maven Central).
Run mvn p2:site on the POM. This will create a p2 site containing the sun.misc fragment at {project-folder}/target/repository.
This p2 repository - and with it the sun.misc fragment - can now be added to your target platform, and hence used in your Tycho build.
This should fix it, and - to answer your question if "there is any possible way [you] can add in [your] plugin itself" - this is the only possible way to do it (I know of).
The sources are also available at https://github.com/newcodeontheblock/eclipse-rcp-with-async-logging. The whole procedure is also described in more detail in this - my - blog post about using async Log4j 2 loggers in an Eclipse RCP.
I have created an open source project that I'd like to publish to maven central so that the users can use the library by simply referencing it in their pom. Like so:
<dependency>
<groupId>in.ksharma</groupId>
<artifactId>log4j-weblayout</artifactId>
<version>0.0.1-BETA</version>
</dependency>
I've found several online tutorials, but some of them are out of date, some recommend automating the entire process and thereby overtly complicate it.
For example one tutorial recommended creating SSH keys for your github account and having maven automatically create a git tag whenever pushing to maven central. Though this is useful it is not necessary to get started.
Another example, trying to release it directly through maven also gives some kind of error:
mvn release:clean release:prepare release:perform -B -e | tee maven-central-deploy.log
Gives:
svn: E155007:
'/home/kshitiz/Documents/workspaces/ggts/log4j-weblayout/pom.xml' is
not a working copy
When you're doing something for the first time it often helps to do it manually first and then automate it.
What is the most basic, bare-bones way to put a JAR in maven central?
1) Create your Jira account : Signup Sonatype
2) Create a new project ticket (to claim your workspace) : Create new project ticket
3) Generate a PGP Signature
gpg2 --gen-key
....
gpg: key YOUR_KEY_ID marked as ultimately trusted
...
4) Distributing your public key
gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys YOUR_KEY_ID
Distribute your key to multiple servers to speed up the synchronization process (pgp.mit.edu, keyserver.ubuntu.com...)
5) Update your ~.m2/settings.xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>jira_username</username>
<password>jira_password</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg2</gpg.executable>
<gpg.passphrase>your_key_passphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
6) Update your project pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>
<groupId>xxx.xxx</groupId>
<artifactId>xxx</artifactId>
<version>0.1</version>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
7) Run Maven
Maven will ask you for your passphrase
mvn clean deploy
8) Comment your Jira ticket
This will trigger the synchronization with central for your group id.
I have promoted my first release. Thanks.
Resources :
OSSRH Guide
Deploy with Maven
PGP Signatures
This answer assumes that you have a maven based project and that it is in a package-able state. mvn package should run without any errors.
When publishing to maven central you'll need to use a group id that would identify all artifacts uploaded by you. Something like in.ksharma. You'll also need to sign your artifacts so that the users are able to verify that they're actually coming from you.
So first go to sonatype jira and create an account, and then create a jira issue to have your group id approved. Something like this.
Now generate a gpg keypair for signing your artifacts:
$ gpg --gen-key
Define this key in ~/.m2/settings.xml:
<profiles>
<profile>
<id>sonatype-oss-release</id>
<properties>
<gpg.keyname>B63EFB4D</gpg.keyname>
<gpg.passphrase>****</gpg.passphrase>
<gpg.defaultKeyring>true</gpg.defaultKeyring>
<gpg.useagent>true</gpg.useagent>
<gpg.lockMode>never</gpg.lockMode>
<gpg.homedir>/home/kshitiz/.gnupg</gpg.homedir>
</properties>
</profile>
</profiles>
Modify your project's pom file and append -SNAPSHOT to your version.
So 0.0.1-BETA becomes 0.0.1-BETA-SNAPSHOT. Otherwise maven would complain:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.4.2:prepare
(default-cli) on project log4j-weblayout: You don't have a SNAPSHOT
project in the reactor projects list. -> [Help 1]
Also add:
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>9</version>
</parent>
This parent pom provides you with some ready made functionality like configuring the maven-gpg-plugin to sign your JAR.
Now run mvn release:clean release:prepare to generate your artifacts and gpg signature. It will give you something like:
log4j-weblayout-0.0.1-BETA-javadoc.jar.asc
log4j-weblayout-0.0.1-BETA-sources.jar.asc
log4j-weblayout-0.0.1-BETA.pom.asc
log4j-weblayout-0.0.1-BETA.pom
log4j-weblayout-0.0.1-BETA.jar.asc
log4j-weblayout-0.0.1-BETA-javadoc.jar
log4j-weblayout-0.0.1-BETA-sources.jar
log4j-weblayout-0.0.1-BETA.jar
Now package these into a single JAR:
jar -cvf bundle.jar log4j-weblayout-0.0.1-BETA*
Go to Sonatype Nexus and login with your credentials. Go to staging upload and upload your bundle.
Then go to staging repositories section, select your repository and click release (More help here). Comment on the jira issue that you have released the artifact and wait some time.
Now your users can search and use the artifact from the central repository:
From the forums that I followed I tried some ways to find a way to deploy mutliple wars using tomcat plugin in maven but I could not succeed.
I created a third project and used three projects in order to deploy them but I have not done it. Could you please tell me way to do it ?
Best Regards
Alper Kopuz
Here is the pom.xml that I used :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>
tr.com.provus.pays
</groupId>
<artifactId>PAYSGroupProject</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>../PAYSWeb</module>
<module>../PAYSDashboard</module>
<module>../PAYSStaticWeb</module>
</modules>
<name>PAYSGroupProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
I guess you cannot use the tomcat plugin on a pom type project, try instead to configure the plugin into one of the war projects and include the others as webapp dependencies with something like that :
<configuration>
<webapps>
<webapp>
<contextPath>/PAYSWeb</contextPath>
<groupId>tr.com.provus.pays</groupId>
<artifactId>PAYSWeb</artifactId>
<version>${project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
</webapp>
<webapp>...</webapp>
</webapps>
</configuration>
Look also at this post (but unanswered)
Each webapp will need a different context root which is supplied to the tomcat7 maven plugin with the "path" value.
You will deploy each web app from its own POM independently. But since you have a pom type project that causes the others to build, you should be able to redeploy all three at once.
Note that there are two ways to deploy using this plugin:
You can deploy without the war. It just compiles the java files and deploys them directly to tomcat.
You can deploy the war. Maven will have to build the war and then it gets deployed to Tomcat. This is more like a production deployment and helps you verify the war will deploy correctly.
So. Move your plugin XML to each of the three "modules" pom files. They will have type 'war'. Then add this under configuration:
<path>paysWeb</path>
under the <configuration> tag for the first 'module'. Of course, you use the different names for the <path> for each of the 'module's.
There is more info here: http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/usage.html