I have a problem running unit test of a maven project.
The project used to be one pom. I split it up into three poms.
My maven is like this. There are three of these poms which looks all 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.mycompany</groupId>
<artifactId>client</artifactId>
<version>1.0</version>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>base-pom</artifactId>
<relativePath>../../build/shared/pom.xml</relativePath>
<version>1.0</version>
</parent>
<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-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<forkMode>never</forkMode>
<useFile>false</useFile>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
....
</dependencies>
The top level pom is:
<groupId>com.mycompany</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>modules/shared</module>
<module>modules/client</module>
<module>modules/adapter</module>
</modules>
The parent POM, which is shared by all the modules are:
<groupId>com.mycompany</groupId>
<artifactId>base-pom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-parent</artifactId>
<version>1.0.8</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.sourceEncoding>UTF-8</project.reporting.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>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
...
</dependencyManagement>
It uses to work when there is just one POM. What is the problem of this?
Many thanks
I would recommend to restructure your projects structure to represent the real layout of the project. I can recommend to reading this entry here on SO
Related
I have a pom.xml file where I get this message Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found. I recently started using Maven and been looking around without any answer
<?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>Declarations</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
My issue is with
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
maven-compiler-plugin says Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found.
I have a spring-boot maven project, which cannot have spring-boot-starter-parent as a parent due to organizational restrictions. I came across the following answer which helped me with compiling, testing and packaging an executable jar.
However when I try to execute spring-boot:run i receive the following error:
No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
The following comment in the answer seems to point to away to fix this:
The code snippet above is sufficient to get the dependency management features. If you want plugins (like spring-boot:run) you need to confute those separately. You can copy paste from the Boot parent if you want
However after adding the proposed section to my pom file I still get the same error. My pom files can be found below:
Parent 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>group.id.foo</groupId>
<artifactId>foo_artifact</artifactId>
<version>version_01</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<modules>
<module>module_01</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!--compilerArgument>-Dfile.encoding=ISO-8859-1</compilerArgument-->
<encoding>${project.build.sourceEncoding}</encoding>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
<executions>
<execution>
<id>default</id>
<phase>compile</phase>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Child 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>
<properties>
<java.version>1.8</java.version>
<main.basedir>${basedir}/../..</main.basedir>
<ing.continuous-delivery.version>00.04.04</ing.continuous-delivery.version>
<maven.assembly.version>2.3</maven.assembly.version>
</properties>
<parent>
<groupId>group.id.foo</groupId>
<artifactId>foo_artifact</artifactId>
<version>version_01</version>
</parent>
<groupId>group.id.foo</groupId>
<artifactId>${project.parent.artifactId}_app</artifactId>
<version>${project.parent.version}</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- tag::spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>1.5.3.RELEASE</version>
</dependency>
<!-- end::spring -->
<!-- tag::web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<version>1.5.3.RELEASE</version>
</dependency>
<!-- end::web -->
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.3.RELEASE</version>
</plugin>
</plugins>
</build>
</project>
Thanks!
In my maven project I have 1 main and 2 modules. It only compiles and runs when I add the two modules to the dependencies in the main pom.xml, otherwise I get compile errors that the reflections library etc is not found.
How can I solve this?
powercontrol.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>nl.nberlijn.powercontrol</groupId>
<artifactId>powercontrol</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>log</module>
<module>kernel</module>
</modules>
<dependencies>
<dependency>
<groupId>nl.nberlijn.powercontrol</groupId>
<artifactId>kernel</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>nl.nberlijn.powercontrol</groupId>
<artifactId>log</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
kernel.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">
<parent>
<groupId>nl.nberlijn.powercontrol</groupId>
<artifactId>powercontrol</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>kernel</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
log.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">
<parent>
<groupId>nl.nberlijn.powercontrol</groupId>
<artifactId>powercontrol</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>log</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Without more details on the code inside each of your modules, it is hard to say why this is. However, by placing your two modules as dependencies in your parent POM, they and their transitive dependencies will be inherited by both child modules.
I think you should be able to resolve this by removing the dependencies from your parent POM, and adding a dependency to your log POM to depend on your kernel module.
I wanna exclude folder marked with red line. How can I do it?
Here is my pom.xml:
<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.test</groupId>
<artifactId>Test</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<url>http://maven.apache.org</url>
<properties>
<spring-version>4.1.0.RELEASE</spring-version>
<spring-security-version>3.2.3.RELEASE</spring-security-version>
<hibernate-version>4.3.4.Final</hibernate-version>
</properties>
<dependencies>
<!-- a lot of dependencies -->
</dependencies>
<build>
<finalName>Test</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Should I do anything with maven-compiler-plugin configuration?
This should give you the answer you need: http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html
Here is an example where we exclude all JAR files from WEB-INF/lib:
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
This doesn't have anything to do with the maven compiler plugin, but the maven war plugin.
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>