Ear and WAR not building - java

Upon executing the command 'maven clean install', I get the following console screen.
My output console using m2eclipse plugin
When I visit the path mentioned in the console screen, there is only a copy of pom.xml file but not EAR and WAR file.
folder view mentioned in console
I wish to build an EAR file which contains a WAR file.
This question was posted by me today and I followed the steps as mentioned by the Gentleman.
I will also share my parent pom.xml
<artifactId>itaras</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>itaras</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>MyEarFile</finalName>
<version>5</version>
<generatedDescriptorLocation>$D:/itaras
/ITARAS_Branch_3Aug2017/itaras/WebContent
</generatedDescriptorLocation>
<modules>
<webModule>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<uri>appITARAS.war</uri>
<bundleFileName>appITARAS.war</bundleFileName>
<contextRoot>/ITARAS</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
<groupId>itaras</groupId>
<profiles>
<profile>
<modules>
<module>itaras-ear</module>
<module>itaras-war</module>
<module>?</module>
</modules>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>itaras</groupId>
<artifactId>itaras-war</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

If you say <packaging>pom</packaging>, you only build a pom. Your child project needs to specify war or ear as packaging.

Related

Maven can't find artifacts

After I'd searched the net and similar StackOverflow questions and tried to apply the proposed sollutions I didn't come up with an idea how to fix this error, which gives me pom.xml:
Multiple annotations found at this line:
- Missing artifact jakarta.json:jakarta.json-
api:jar:2.0.0-RC3
- Missing artifact org.glassfish.hk2:hk2-
locator:jar:3.0.0-M2
- Missing artifact org.glassfish:jakarta.json:jar:2.0.0-
RC3
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 //error appears here
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.gson</groupId>
<artifactId>advanced-jaxrs-01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>advanced-jaxrs-01 Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-
media-moxy -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>3.0.0-M6</version>
</dependency>
<!--
https://mvnrepository.com/artifact/org.glassfish.jersey.bundles/jaxrs-ri -
->
<dependency>
<groupId>org.glassfish.jersey.bundles</groupId>
<artifactId>jaxrs-ri</artifactId>
<version>3.0.0-M6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>advanced-jaxrs-01</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-
bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
I've had a look at .m2/repository and I've noticed, that there are files maven can't find. What should I do? What's the matter?
If there are files that maven can't find, you can always try to install the JAR file and going into
Project folder properties --> Java Build Path --> Add external JARs (Click on Modulepath if you cant immediately press Add External JARs)

Maven - adding a war dependency to another war

I'm developing a Jersey webapp that serves as a webhook for chatbots, currently I have a generic service that handles the basic connections and now I want to create a specific app webhook that will be able to use the generic service.
I've already added the generic webapp as a maven dependency and can use it in my workspace, but when deploying to tomcat I get error:
[org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError:
.../generic/services/Webhook] with root cause
java.lang.ClassNotFoundException: ...generic.services.Webhook
Generic services pom file:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</parent>
<artifactId>...-generic-services</artifactId>
<name>...</name>
<groupId>...</groupId>
<packaging>jar</packaging>
<properties>
<jersey.version>2.27</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
...
</dependencies>
<build>
<finalName>...</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
</plugins>
</build>
App services pom file:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</parent>
<artifactId>...-app-services</artifactId>
<name>...</name>
<groupId>...</groupId>
<packaging>war</packaging>
<properties>
<jersey.version>2.27</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>..generic.services</groupId>
<artifactId>...-generic-services</artifactId>
<version>...</version>
<classifier>classes</classifier>
</dependency>
</dependencies>
<build>
<finalName>...-app-services</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
So what I basically want to accomplish is to be able to call the generic services functions from the app service webapp, so for example if in generic service there is a function that receives and returns a json then I want to be able to make a function like this in app and call the generic service function with a json and receive from it.
You can't add a WAR as a Maven dependency. WAR has a specific layout which is understood by Servlet Containers and JEE Servers. This layout is not understood by other tools e.g. Maven which expects dependencies to be JARs.
This problem is normally solved by extracting either a new services-common Maven module which stores the shared code or moving the Java code outside of the WAR into a new JAR Maven module.
You can try using WAR Overlays to achieve what you want but it won't be as clean as extracting new JAR Modules.

Do you always need to run separately the pom.xml of each projects in Maven before deploying to Tomcat?

I have a main application called MainApp. This app contains a dashboard project and store project. Whenever I make change to either dashboard or store project, I had to run the maven clean install via IntelliJ for the project where I make the change. Then I go to my maven configuration for the MainApp pom.xml then run the pom.xml via clean install tomcat7:run -Pfront-end-build -U to deploy the project.
Is this the right way of doing it? I know this is a bit subjective,but I was thinking won't it be possible to just compile, build and run everything from MainApp? I noticed when I run the pom.xml in MainApp, it just gets the dependency wars ( store and dashboard ) from our Nexus repo (so I guess that war don't contain my latest changes).
MainApp
pom.xml
-----dashboard
-------pom.xml
-----store
-------pom.xml
MainApp pom.xml
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.pab</groupId>
<artifactId>MainApp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>store</module>
<module>dashboard</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
dependency....
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<webapps>
<webapp>
<contextPath>/store</contextPath>
<groupId>com.pab</groupId>
<artifactId>store</artifactId>
<version>${project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
</webapp>
<webapp>
<contextPath>/</contextPath>
<groupId>com.pab</groupId>
<artifactId>dashboard</artifactId>
<version>${project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
</webapp>
</webapps>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<uniqueVersion>true</uniqueVersion>
<url>${release.repo.url}</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<uniqueVersion>false</uniqueVersion>
<url>${snapshot.repo.url}</url>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>
dashboard pom.xml
<modelVersion>4.0.0</modelVersion>
<artifactId>dashboard</artifactId>
<packaging>war</packaging>
<name>dashboard</name>
<parent>
<groupId>com.pab</groupId>
<artifactId>MainApp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<properties>
<webpack.cmd>webpack</webpack.cmd>
</properties>
<profiles>
<profile>
<id>front-end-build</id>
<build>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<finalName>dashboard</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
</build>
</project>
store pom.xml
<modelVersion>4.0.0</modelVersion>
<artifactId>store</artifactId>
<packaging>war</packaging>
<name>store</name>
<parent>
<groupId>com.pab</groupId>
<artifactId>MainApp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<profiles>
<profile>
<id>front-end-build</id>
<build>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<finalName>store</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<systemProperties>
<org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING>false
</org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING>
</systemProperties>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.4.0</version>
<configuration>
<workingDirectory>src/main/client</workingDirectory>
</configuration>
<executions>
<execution>
<id>npm</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>webpack</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
<environmentVariables>
<NODE_ENV>
production
</NODE_ENV>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Now, after struggling with this for quite some time. I did some more testing.
I run mvn clean install -Pfront-end-build -U via git bash in the MainApp folder, essentially this executed the pom.xml in that folder which is the parent pom.xml of the inner modules. It successfully built the inner modules store and dashboard. However what I noticed is, when i execute this command in IntelliJ: clean install -Pfront-end-build -U tomcat7:run . The inner modules are not being built. It seemed that the tomcat plugin is trying to deploy the modules immediately thus it is trying to get the war files from the repository. This is where the problem lies now. For now, what I'm doing is i build the whole project (together with the inner modules) outside intelli J then go back to intelli J and run the tomcat maven plugin (tomcat7:run) so I'll have the option to debug through the code using intelli J.
Your main pom xml has store and dashboard defined as modules so if you mvn clean install at main pom xml it should build both the projects and your changes should be reflected in new war.
<modules>
<module>store</module>
<module>dashboard</module>
</modules>
If you are running tomcat in ide like eclipse then once you build your project then it should show synchronized or needs synchronized besides tomcat server. If later then right click on tomcat server and restart tomcat server and it should synchronize i.e. redeploy wars on tomcat server.

Maven web module not running from inside Eclipse

I have configure Maven Multimodule project and when i am doing
mvn clean install
It is Creating War and Jar files for both the modules in the parent project and when i am deploying war file in Tomcat6 it is working fine.
But when i am trying to run the web module from inside eclipse .
Right Click on project->Run on Server ->Selected Tomcat as a Server
Then Project not working .
The Web Module is depended on the java project which is also a part of Multimodule project so i added dependency of this(Java) project into my web project but in web project Java build path not containing this dependency .Can anyone know how can i resolve this issue with eclipse?
As i saw in eclipse's
workspace_maven.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\web\WEB-INF\lib
i did not found the Java project here .But when i am doing
mvn clean install
and deploying that war in Tomcat the /WEB-INF/lib directory containing my Java Project jar file.
My Web Module Pom.xml file...
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.test</groupId>
<artifactId>demo_parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.csdc</groupId>
<artifactId>demo-web</artifactId>
<version>7.0.0</version>
<packaging>war</packaging>
<name> web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.test</groupId>
<artifactId>core-java</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>amanda-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
</project>
And my parent pom.xml file...
<?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>
<groupId>org.test</groupId>
<artifactId>demo_parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>demo-web</module>
<module>core-java</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
</project>
*Note:-*I have removed repository and dependency from parent pom.xml to make pom short.
You should need the apache maven plugin
The goal should be like tomcat:run
It will download the new instance of tomcat in your target folder and deploy your war on that tomcat.
You can set all the setting for that tomcat or can refer the setting XML in the configuration tag of the plugin.
You can run it as debug mode and all the changes can be seen on the fly. (Java, JSP files only. no XML and properties)
for your help I am adding a code that would help you in running the tomcat server and deploy the WAR when you install the web module.
The application will be installed in tomcat 5 and on the root context.
You can access it on URL: http://localhost:8080/
<project>
...
<build>
<finalName>myWAR</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<path>/</path>
</configuration>
<executions>
<execution>
<id>RUN_TOMCAT</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<inherited>false</inherited>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Maven: Development and Release versions for Libraries

I have a project consisting of 3 libraries - let's call them 1) BABY, 2) CHILD and 3) ADULT. Lib "CHILD" depends on "BABY" and "ADULT" depends on "CHILD".
What I want to do is produce:
a dev version that has all the (transitive) dependencies
a production version that creates a standalone JAR for each library (embedding the dependencies)
I have a profile dev and a profile release already, and I know how to use ProGuard to generate the JAR.
The question is how to tell Maven to keep all dependencies in dev and ignore them (optional/provided) in production?
To have different dependencies when you develop to deployment you could use maven profiles.
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
So when developing you would use something like mvn -Pdev compile
When you say "standalone jar" it sounds like you mean a jar with all dependencies merged into it.
How can I create an executable JAR with dependencies using Maven?
or http://maven.apache.org/plugins/maven-assembly-plugin/
Here is what I used eventually:
The parent POM defines a profile release that configurates the proguard plugin (crates one big JAR) and the install plugin (places the release artifact in the repo).
The lib-baby POM simply calls the 2 plugins in the <build> section.
The lib-child POM additionally specifies a dev profile where the dependency to lib-baby is defined. Within the release profile this dependency has an optional tag and is included in the big JAR.
In the end when run by default, the libs com.company.dev:lib-baby and com.company.dev:lib-child are created (included their dependencies).
When run with -Prelease the libs com.company:lib-baby and com.company:lib-child are created (standalone libs [WITHOUT any dependencies]) - only side effect is that the default artifacts (.*dev) are overwritten :(
parent:
<project>
<groupId>com.company</groupId>
<artifactId>lib-parent</artifactId>
<packaging>pom</packaging>
<modules>
<module>lib-baby</module>
<module>lib-child</module>
<module>lib-adult</module>
</modules>
<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>release</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<!-- aggregate to one big jar -->
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
...
</executions>
<configuration>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}-release.jar</outjar>
....
</configuration>
</plugin>
<!-- install release version of artifact separately (under com.company) -->
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-release</id>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>
target/${project.build.finalName}-release.jar
</file>
<groupId>com.company</groupId>
...
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
lib-baby:
<project>
<groupId>com.company.dev</groupId>
<artifactId>lib-baby</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.company</groupId>
<artifactId>lib-parent</artifactId>
</parent>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- produces 'lib-baby-release.jar -->
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
</plugin>
<!-- installs 'lib-baby-release.jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-release</id>
<phase>install</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
lib-child:
<project>
<groupId>com.company.dev</groupId>
<artifactId>lib-child</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.company</groupId>
<artifactId>lib-parent</artifactId>
</parent>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.company.dev</groupId>
<artifactId>lib-baby</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>release</id>
<dependencies>
<dependency>
<groupId>com.company.dev</groupId>
<artifactId>lib-baby</artifactId>
<version>1.0</version>
<!-- made optional because will be embedded in standalone jar -->
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<!-- produces 'lib-child-release.jar -->
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<configuration>
<assembly>
<inclusions>
<inclusion>
<groupId>com.company.dev</groupId>
<artifactId>lib-baby</artifactId>
</inclusion>
</inclusions>
</assembly>
</configuration>
</plugin>
<!-- installs 'lib-child-release.jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-release</id>
<phase>install</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Categories

Resources