Hi,

you setup is a bit weird. To correct way to implement this is to set up an 
extra pom.xml (module) which has
<packging>ear</packaging>
and a dependency to my_child_project.
Then the EAR will build correctly because it complies with the Maven rule: one 
pom.xml, project, module, whatever you call it, produces one output file 
(artifact).

HTH,

Stefan

On Fri, 6 Mar 2009 07:05:23 +0000
Fredrik Andersson <fredan...@hotmail.com> wrote:

> 
> How to add a jar file to a ear with Maven
>                       Hello!
> 
> I have a small ejb-app in a project (my_child_project).
> But when I try to build the ear I do not manage to get it inside.
> Bellow 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/xsd/maven-4.0.0.xsd";>
>     <parent>
>         <groupId>home</groupId>
>         <artifactId>my_parent_project</artifactId>
>         <version>1.0</version>
>         <relativePath>../my_parent_project/pom.xml</relativePath>
>     </parent>
> 
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>home</groupId>
>     <artifactId>my_child_project</artifactId>
>     <packaging>jar</packaging>
>     <version>1.0</version>
>     <name>my_child_project</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>home</groupId>
>             <artifactId>my_other_child_project</artifactId>
>             <version>1.0</version>
>         </dependency>
>     </dependencies>
> 
>     <build>
>     <plugins>
>         <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-compiler-plugin</artifactId>
>             <version>2.0.2</version>
>             <configuration>
>                 <source>1.5</source>
>                 <target>1.5</target>
>             </configuration>
>         </plugin>
>         <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-ejb-plugin</artifactId>
>             <configuration>
>                 <ejbVersion>3.0</ejbVersion>
>                 <jarName>my_child_project_jar_server</jarName>
>                 
> <outputDirectory>${project.build.outputDirectory}</outputDirectory>
>                 <generateClient>true</generateClient>
>             </configuration>
>         </plugin>
>         <plugin>
>             <artifactId>maven-ear-plugin</artifactId>
>             <configuration>
>                 <finalName>my_child_project_ear_server</finalName>
>                 <modules>
>                     <jarModule>
>                         <groupId>home</groupId>
>                         <artifactId>my_child_project</artifactId>
>                     </jarModule>
>                 </modules>
>             </configuration>
>         </plugin>
> 
>     </plugins>
>     </build>
> </project>
> 
> 
> When I run:
> mvn clean install
> ...I get:
>  my_child_project.jar
> 
> When I run:
> mvn ejb:ejb
> ...I get:
>  my_child_project_jar_server.jar
>  my_child_project_jar_server-cleint.jar
> 
> 
> But when I try:
> mvn ear:generate-application-xml
> ...or...
> mvn ear:ear
> 
> I get an error about
> [INFO] Artifact[jar:home:my_child_project] is not a dependency of the project.
> 
> It seems like Maven does not like to put the project it self into the ear?
> 
> Any comments is most welcome!
> Best regards
> Fredrik
>               
> _________________________________________________________________
> Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
> 
> http://www.microsoft.com/windows/windowslive/products/photos.aspx

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

Reply via email to