You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joerg Heinicke <jo...@gmx.de> on 2009/09/06 14:47:06 UTC

Why is my WAR exploded in the EAR?

Hi,

I'm trying to create an EAR from my WAR file. The WAR itself works perfectly.
Now I expected ear:ear will simply create my EAR file. (It is supposed to
consist only of this one web module.) Unfortunately the WAR is exploded in the
EAR's root.

I searched in the archives but it seems people usually want to have it the other
way around. I also tried configuring the ear plugin by declaring the web module

  <modules>
    <webModule>
      <groupId>my.project</groupId>
      <artifactId>project-web</artifactId>
      <bundleFileName>project-web.war</bundleFileName>
    </webModule>
  </modules>

Now it chokes on missing dependency on the project-web artifact. Does that mean
I need a separate project just for the EAR?

My pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="..."
  xsi:schemaLocation="...">
  <modelVersion>4.0.0</modelVersion>
  <groupId>my.project</groupId>
  <artifactId>project-web</artifactId>
  <packaging>war</packaging>
  <version>SNAPSHOT</version>
  <name>My Project</name>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
         
<applicationXml>src/main/resources/META-INF/application.xml</applicationXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    ...
  </dependencies>
</project>

Any ideas?
Thanks in advance,
Joerg


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


Re: Why is my WAR exploded in the EAR?

Posted by Aleksey Didik <di...@magenta-technology.ru>.
Unfortunately not,
you can't use parent project with packaging pom as ear module.
Own module for EAR is a part of Maven paradigm: module -> artifact.
EAR plugin just replace JAR plugin in EAR module and it can't be used 
just like surefire plugin.
In other words, EAR plugin doesn't attach to necessary build phase. It 
replace packaging mechanism of Maven.
Is it a problem to make one new module?
If you war module is a main and alone module in project, and you don't 
want to create parent module and change project structure, just make one 
more project, only for EAR.

Parent POM could be used for dependencies specification which must be 
included into EAR.

Best regards,
Aleksey Didik



Joerg Heinicke ?????:
> Aleksey Didik <didik <at> magenta-technology.ru> writes:
>
>   
>> Using separate module for EAR is the most useful solution.
>> This module is description of "what must be in the ear".
>> Use <packaging>ear</packaging>, <modules> section in the <configuration> 
>> and, attention, don't forget add dependency to project-web artifact to 
>> <dependencies> section.
>>     
>
> Thanks Aleksey.
>
> Can I directly combine this with a parent POM? From another thread I got a
> parent POM is helpful in general for centralizing dependency management. I
> already have multiple projects for the JARs of the webapp. (I overtook the
> application, but only the source code, not the build files.) So can I use the
> parent POM for also specifying the content of the EAR as you described above?
>
> Joerg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   

Re: Why is my WAR exploded in the EAR?

Posted by Joerg Heinicke <jo...@gmx.de>.
Aleksey Didik <didik <at> magenta-technology.ru> writes:

> Using separate module for EAR is the most useful solution.
> This module is description of "what must be in the ear".
> Use <packaging>ear</packaging>, <modules> section in the <configuration> 
> and, attention, don't forget add dependency to project-web artifact to 
> <dependencies> section.

Thanks Aleksey.

Can I directly combine this with a parent POM? From another thread I got a
parent POM is helpful in general for centralizing dependency management. I
already have multiple projects for the JARs of the webapp. (I overtook the
application, but only the source code, not the build files.) So can I use the
parent POM for also specifying the content of the EAR as you described above?

Joerg


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


Re: Why is my WAR exploded in the EAR?

Posted by Aleksey Didik <di...@magenta-technology.ru>.
Hi,

Using separate module for EAR is the most useful solution.
This module is description of "what must be in the ear".
Use <packaging>ear</packaging>, <modules> section in the <configuration> 
and, attention, don't forget add dependency to project-web artifact to 
<dependencies> section.

Like below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="..."
  xsi:schemaLocation="...">
  <modelVersion>4.0.0</modelVersion>
  <groupId>my.project</groupId>
  <artifactId>project-ear</artifactId>
  <packaging>ear</packaging>
  <version>SNAPSHOT</version>
  <name>My Project</name>
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>         
	   <modules>
	      <webModule>
	        <groupId>my.project</groupId>
	        <artifactId>project-web</artifactId>
	        <bundleFileName>project-web.war</bundleFileName>
	      </webModule>
	   </modules>
	   <applicationXml>src/main/resources/META-INF/application.xml</applicationXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    ...
	<dependency>
            <groupId>my.project</groupId>
	    <artifactId>project-web</artifactId>
            <version>SNAPSHOT</version> 
        </dependency> 
  </dependencies>
</project>

Belive, it will help your.

Best regards,
Aleksey Didik




Joerg Heinicke пишет:
> Hi,
>
> I'm trying to create an EAR from my WAR file. The WAR itself works perfectly.
> Now I expected ear:ear will simply create my EAR file. (It is supposed to
> consist only of this one web module.) Unfortunately the WAR is exploded in the
> EAR's root.
>
> I searched in the archives but it seems people usually want to have it the other
> way around. I also tried configuring the ear plugin by declaring the web module
>
>   <modules>
>     <webModule>
>       <groupId>my.project</groupId>
>       <artifactId>project-web</artifactId>
>       <bundleFileName>project-web.war</bundleFileName>
>     </webModule>
>   </modules>
>
> Now it chokes on missing dependency on the project-web artifact. Does that mean
> I need a separate project just for the EAR?
>
> My pom.xml:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="..."
>   xsi:schemaLocation="...">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>my.project</groupId>
>   <artifactId>project-web</artifactId>
>   <packaging>war</packaging>
>   <version>SNAPSHOT</version>
>   <name>My Project</name>
>   <build>
>     <plugins>
>       ...
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-ear-plugin</artifactId>
>         <configuration>
>          
> <applicationXml>src/main/resources/META-INF/application.xml</applicationXml>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>   <dependencies>
>     ...
>   </dependencies>
> </project>
>
> Any ideas?
> Thanks in advance,
> Joerg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>   

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