You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2010/11/19 18:59:27 UTC

Head start with relatively simple EAR/WAR project?

I'm trying to convert a project built with Ant to Maven.  It uses CXF
and Spring, and it builds a WAR and EAR.  My first attempt is having
problems, probably because I'm missing some basic elements.

I've constructed the first draft of the POM, but when I run "mvn", it
didn't appear to compile my Java sources, and the EAR it constructed (I
suppose I should feel fortunate that I got an EAR at all) put the jar
dependencies in the root of the EAR.  I suppose that last issue is
because I haven't defined "module" elements.

My Java source is in "src/main/java".

Here's my POM so far:
---------------------------
<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>MyApp</groupId>
  <artifactId>MyApp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>ear</packaging>
  <build>
  	<defaultGoal>install</defaultGoal>
  	<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.4.2</version>
  			<configuration>
  			</configuration>
  		</plugin>
  	</plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf</artifactId>
      <version>2.3.0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>3.0.5.RELEASE</version>
    </dependency>
  </dependencies>
</project>
---------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Head start with relatively simple EAR/WAR project?

Posted by Manfred Moser <ma...@mosabuam.com>.
>> -----Original Message-----
>> From: KARR, DAVID (ATTSI)
>> Sent: Friday, November 19, 2010 9:59 AM
>> To: users@maven.apache.org
>> Subject: Head start with relatively simple EAR/WAR project?
>>
>> I'm trying to convert a project built with Ant to Maven.  It uses CXF
>> and Spring, and it builds a WAR and EAR.  My first attempt is having
>> problems, probably because I'm missing some basic elements.
>>
>> I've constructed the first draft of the POM, but when I run "mvn", it
>> didn't appear to compile my Java sources, and the EAR it constructed
> (I
>> suppose I should feel fortunate that I got an EAR at all) put the jar
>> dependencies in the root of the EAR.  I suppose that last issue is
>> because I haven't defined "module" elements.
>>
>> My Java source is in "src/main/java".
>>
>> Here's my POM so far:
>> ---------------------------
>> <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>MyApp</groupId>
>>   <artifactId>MyApp</artifactId>
>>   <version>0.0.1-SNAPSHOT</version>
>>   <packaging>ear</packaging>
>>   <build>
>>   	<defaultGoal>install</defaultGoal>
>>   	<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.4.2</version>
>>   			<configuration>
>>   			</configuration>
>>   		</plugin>
>>   	</plugins>
>>   </build>
>>   <dependencies>
>>     <dependency>
>>       <groupId>org.apache.cxf</groupId>
>>       <artifactId>cxf</artifactId>
>>       <version>2.3.0</version>
>>       <type>pom</type>
>>     </dependency>
>>     <dependency>
>>       <groupId>org.springframework</groupId>
>>       <artifactId>spring-beans</artifactId>
>>       <version>3.0.5.RELEASE</version>
>>     </dependency>
>>   </dependencies>
>> </project>
>> ---------------------
>
> Related to this, is it possible to have a single project that constructs
> both an EAR and a WAR inside the EAR?  The few examples I can find all
> have a parent project for the EAR and a subproject for the WAR.  Is that
> partially why I'm having problems with this?

Yes... having them in separate projects follows the Maven best practice of
one artifact per module and is what will work best. If you see a bunch of
examples.. follow them.

manfred

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Head start with relatively simple EAR/WAR project?

Posted by ad...@gmail.com.
That is your answer. But you manage the dependency so that you only need compile the War for changes in development. Then package when you need to (re)deploy. Ie in dev not every change requires this. What depends on other things 
Sent using BlackBerry® from Orange

-----Original Message-----
From: "KARR, DAVID (ATTSI)" <dk...@att.com>
Date: Fri, 19 Nov 2010 11:26:11 
To: Maven Users List<us...@maven.apache.org>
Reply-To: "Maven Users List" <us...@maven.apache.org>
Subject: RE: Head start with relatively simple EAR/WAR project?

> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Friday, November 19, 2010 9:59 AM
> To: users@maven.apache.org
> Subject: Head start with relatively simple EAR/WAR project?
> 
> I'm trying to convert a project built with Ant to Maven.  It uses CXF
> and Spring, and it builds a WAR and EAR.  My first attempt is having
> problems, probably because I'm missing some basic elements.
> 
> I've constructed the first draft of the POM, but when I run "mvn", it
> didn't appear to compile my Java sources, and the EAR it constructed
(I
> suppose I should feel fortunate that I got an EAR at all) put the jar
> dependencies in the root of the EAR.  I suppose that last issue is
> because I haven't defined "module" elements.
> 
> My Java source is in "src/main/java".
> 
> Here's my POM so far:
> ---------------------------
> <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>MyApp</groupId>
>   <artifactId>MyApp</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>   <packaging>ear</packaging>
>   <build>
>   	<defaultGoal>install</defaultGoal>
>   	<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.4.2</version>
>   			<configuration>
>   			</configuration>
>   		</plugin>
>   	</plugins>
>   </build>
>   <dependencies>
>     <dependency>
>       <groupId>org.apache.cxf</groupId>
>       <artifactId>cxf</artifactId>
>       <version>2.3.0</version>
>       <type>pom</type>
>     </dependency>
>     <dependency>
>       <groupId>org.springframework</groupId>
>       <artifactId>spring-beans</artifactId>
>       <version>3.0.5.RELEASE</version>
>     </dependency>
>   </dependencies>
> </project>
> ---------------------

Related to this, is it possible to have a single project that constructs
both an EAR and a WAR inside the EAR?  The few examples I can find all
have a parent project for the EAR and a subproject for the WAR.  Is that
partially why I'm having problems with this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Head start with relatively simple EAR/WAR project?

Posted by Antonio Petrelli <an...@gmail.com>.
2010/11/19 KARR, DAVID (ATTSI) <dk...@att.com>:
> Related to this, is it possible to have a single project that constructs
> both an EAR and a WAR inside the EAR?  The few examples I can find all
> have a parent project for the EAR and a subproject for the WAR.  Is that
> partially why I'm having problems with this?

No, you need to have a POM project with an EAR module, a WAR module,
and an EJB module.
Take a look at this archetype:
http://code.google.com/p/javaee5-maven-archetype/

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Head start with relatively simple EAR/WAR project?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Friday, November 19, 2010 9:59 AM
> To: users@maven.apache.org
> Subject: Head start with relatively simple EAR/WAR project?
> 
> I'm trying to convert a project built with Ant to Maven.  It uses CXF
> and Spring, and it builds a WAR and EAR.  My first attempt is having
> problems, probably because I'm missing some basic elements.
> 
> I've constructed the first draft of the POM, but when I run "mvn", it
> didn't appear to compile my Java sources, and the EAR it constructed
(I
> suppose I should feel fortunate that I got an EAR at all) put the jar
> dependencies in the root of the EAR.  I suppose that last issue is
> because I haven't defined "module" elements.
> 
> My Java source is in "src/main/java".
> 
> Here's my POM so far:
> ---------------------------
> <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>MyApp</groupId>
>   <artifactId>MyApp</artifactId>
>   <version>0.0.1-SNAPSHOT</version>
>   <packaging>ear</packaging>
>   <build>
>   	<defaultGoal>install</defaultGoal>
>   	<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.4.2</version>
>   			<configuration>
>   			</configuration>
>   		</plugin>
>   	</plugins>
>   </build>
>   <dependencies>
>     <dependency>
>       <groupId>org.apache.cxf</groupId>
>       <artifactId>cxf</artifactId>
>       <version>2.3.0</version>
>       <type>pom</type>
>     </dependency>
>     <dependency>
>       <groupId>org.springframework</groupId>
>       <artifactId>spring-beans</artifactId>
>       <version>3.0.5.RELEASE</version>
>     </dependency>
>   </dependencies>
> </project>
> ---------------------

Related to this, is it possible to have a single project that constructs
both an EAR and a WAR inside the EAR?  The few examples I can find all
have a parent project for the EAR and a subproject for the WAR.  Is that
partially why I'm having problems with this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org