AspectJ compiler doesn compile *.aj files - java

I have the following project:
root
|---pom.xml
src/main/java
|---com.package
|----App.java
src/main/aspects
|---com.package
|----Trace.aj
Now, the pom.xml is
<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.package</groupId>
<artifactId>aspectj-test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>aspectj-test</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<configuration>
<ajdtBuildDefFile>build.ajproperties</ajdtBuildDefFile>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
After executing mvn aspectj:compile I got only the App.class compiled class, but didn't Trace.class. What's wrong with that?

By default the aspectj-maven-plugin expects the aspects in the directory src/main/aspect. If you want to store them in a different directory, you have to specify the configuration:
<configuration>
<aspectDirectory>src/main/aspects</aspectDirectory>
</configuration>

Related

maven-shade-plugin: Cannot load implementation hint

I want to create a simple uber-jar for my non-modular project using shade. I followed the documentation at
[https://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html]
but somehow, i keep getting this error:
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.4.1:shade (default) on project SharkTouch: Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.4.1:shade for parameter transformers: Cannot load implementation hint 'org.example.Main'
here is my 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>
<groupId>org.example</groupId>
<artifactId>SharkTouch</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>org.reactfx</groupId>
<artifactId>reactfx</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.example.Main">
<mainClass>org.example.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Shaded class (from uber jar) are not visible in other project to import

I am trying to shade dependency (building uber jar) and importing in other project.In uber jar I can see class but when I try to import the shaded folder/package do not show.Below are my pom.xmls
Test1 with shaded dependency and uber jar
<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>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<jdk.version>1.8</jdk.version>
<jodatime.version>2.5</jodatime.version>
</properties>
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${jodatime.version}</version>
</dependency>
</dependencies>
<build>
<finalName>test</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<!-- Set a compiler level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!-- Maven Shade Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>org.joda</pattern>
<shadedPattern>test.shaded.org.joda</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Test2 where I added test1 as dependency
<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>test2</groupId>
<artifactId>test2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
But when I try to import test.shaded.org.joda in Test2 project, dependency is not showing.

Annotation processing with kotlin-maven-plugin

So i have maven project with 2 modules.
Root pom.xml looks 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>kashier</groupId>
<artifactId>Kashier</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>AnnotationProcessing</module>
<module>TestProject</module>
</modules>
And the pom.xml for AnnotationProcessing module :
<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>kashier</groupId>
<artifactId>Kashier</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>AnnotationProcessing</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<kotlin.version>1.0.3</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc2</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Now everything works fine only if i manually create javax.annotation.processing.Processor file in resources directory.
That means that auto-service is not working and the question is: how do i make it work?
Also i tried to make the same project with java and it works. So i think that the problem is in kotlin-maven-plugin.
Source code of the project can be found here
auto-service is using annotation processor too so you have to add into your kotlin-maven-plugin (before compile section) this:
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>src/main/java</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<!-- Specify your annotation processors here. -->
<annotationProcessorPath>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc4</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>

Spring toolsuite shows error on <execution> for maven-jaxb2-plugin

I am using Spring Tool Suite version 3.7.0.RELEASE and I'm trying out an import of a WSDL offered by Amazon. The import succeeds, but Eclipse gives an error message on the tag.
I am using the following 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>
<groupId>com.example</groupId>
<artifactId>blafoo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>blafoo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::wsdl[] -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>be.goedkoperzoeken.amazonapi.wsdl</generatePackage>
<schemas>
<schema>
<url>http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
<!-- end::wsdl[] -->
</plugins>
</build>
</project>
When hovering over this tag, I get the following error message:
Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate: com/sun/xml/bind/v2/model/core/TypeInfoSet
I was able to fix this by putting my <plugins> inside of a <pluginManagement> tag. Somehow this makes it different for maven and it actually picks up the correct information.
Putting it in <pluginManagement> means it won't get executed. Plugin version 0.13.2 fixes this issue.
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.2</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

Building enterprise application using Maven

I am learning Maven and I need some help understanding how it works.
I have an application. Previously building was made using ANT. Now I am migrating it to Maven. I want to make an .ear file. Application is web service which is WSDL-first, for that I am using cxf-codegen-plugin Maven plugin. Code generates successfully, everything is ok with that part except, how to make a .jar file of generated sources.
Is it possible to build application with just one Maven pom.xml file? Or I need separate Maven files to build a .jar file of generated sources, to build .war file and other pom.xml file to finally to build an .ear file?
My maven file looks like this:
<?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>com.groupgti.ws.bizzbuzz</groupId>
<artifactId>BizzBuzzWSEAR</artifactId>
<version>1.0</version>
<packaging>ear</packaging>
<name>BizzBuzzWSEAR</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- All needed dependencies -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<includes>
<include>src/main/**</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/webapp/WEB-INF/wsdl/BizzBuzz.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I run this script .ear file gets created, but with no .war file in it. The sequence of creating artifacts should be: generate-code-from-wsdl, compile-it, make-jar, build-war, build-ear.
How can I build that sequence of targets with Maven?
After some trying and testing I managed to do it my self.
I have created one project called BizzBuzzWSEAR, then I created pom.xml file for it. It looks like this:
<?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>com.groupgti.ws.bizzbuzz</groupId>
<artifactId>BizzBuzzWSEAR</artifactId>
<version>1.0</version>
<modules>
<module>BizzBuzz-web</module>
<module>BizzBuzz-ear</module>
<module>BizzBuzz-cxf</module>
</modules>
<packaging>pom</packaging>
<name>BizzBuzzWSEAR</name>
</project>
Then I have created three other modules:
BizzBuzz-web - for web application (web service)
BizzBuzz-ear - for enterprise application
BizzBuzz-cxf - for wsdl2java .jar file
BizzBuzz-web module pom.xml looks like this:
<?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">
<parent>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>BizzBuzz-web</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
<packaging>war</packaging>
<name>BizzBuzz-web</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<artifactId>BizzBuzz-cxf</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
BizzBuzz-ear module pom.xml file looks like this:
<?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">
<parent>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>BizzBuzz-ear</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
<packaging>ear</packaging>
<name>BizzBuzz-ear</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<artifactId>BizzBuzz-web</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
</dependencies>
</project>
And for BizzBuzz-cxf module pom.xml file looks like this:
<?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">
<parent>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>BizzBuzz-cxf</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
<packaging>jar</packaging>
<name>BizzBuzz-cxf</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/BizzBuzz.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Then when I build my project BizzBuzzWSEAR pom.xml file build everything and packages to .ear file. Hope this information for someone will be useful.
Here are some hints/suggestions/improvements about your created pom's:
First you should define a version 1.0-SNAPSHOT instead of 1.0 cause your app is under development and not yet released.
In this case you have a multi-module build which has some advantages in using. You are defining the version number and group id in every module like this:
<parent>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<artifactId>BizzBuzz-web</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
<packaging>war</packaging>
In a multi-module build as yours you can reduce this to the following (best practice like):
<parent>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<artifactId>BizzBuzz-web</artifactId>
<packaging>war</packaging>
The groupId and the version will be inherited by the parent to the modules which makes the pom's smaller.
Furthermore you should put global configurations like the properties:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
into the parent pom. Apart from that you can define the default version etc. for plugins in the parent as well like the following (parent):
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
...
which will result into the following ear module pom:
<?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>
<artifactId>BizzBuzzWSEAR</artifactId>
<groupId>com.groupgti.ws.bizzbuzz</groupId>
<version>1.0</version>
</parent>
<artifactId>BizzBuzz-ear</artifactId>
<packaging>ear</packaging>
<name>BizzBuzz-ear</name>
<dependencies>
<dependency>
<groupId>${project.goupId}</groupId>
<artifactId>BizzBuzz-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
</project>

Categories

Resources