0

I have to create a dynamic webapplication. And I have to create an ear-file from it. I also want to use maven. What is the best way to do this in eclipse?

I found the "maven-archetype-j2ee-simple" archetype (Create complete EAR Project with Maven and Eclipse Helios). Can someone tell me what I have to put in which folder(controllers,test,jsp-sites,java classes) and how I create an ear-file.

If I run maven I get errors

 Child module */site of */pom.xml does not exist

I just need to delete <module>site</module> in the root pom.xml to get rid of this error but I dont even know what this one is doing. And why this archetyp got errors?

Kindly Regards!

Community
  • 1
  • 1
SamuelTJackson
  • 1,357
  • 3
  • 19
  • 40

1 Answers1

1

There appears to be a bug in this archetype (it's quite old by the looks of the ejb module), you can delete the site module from the parent pom, I assume it was supposed to be a maven site.

I would however suggest that you do not use this archetype.

Create a war project from the maven-archetype-webapp, then create your own parent and your own ear project to package the war.

The parent would look like this:

<modules>
        <module>poc-war</module>
        <module>poc-ear</module>
</modules>

The ear pom would have a dependency on the war project and use the maven ear plugin to generate an ear:

<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>

        <parent>
                <groupId>net.isban</groupId>
                <artifactId>poc</artifactId>
                <version>1.0-SNAPSHOT</version>
        </parent>

        <artifactId>poc-ear</artifactId>
        <packaging>ear</packaging>

        <description>EAR deployment </description>
        <name>FMIS EAR</name>

        <dependencies>
                <dependency>
                        <groupId>net.isban</groupId>
                        <artifactId>poc-war</artifactId>
                        <version>${project.version}</version>
                        <type>war</type>
                </dependency>
        </dependencies>

        <build>
                <finalName>${project.artifactId}-${project.version}</finalName>
                <plugins>
                        <plugin>
                                <artifactId>maven-ear-plugin</artifactId>
                                <version>2.10.1</version>
                                <configuration>
                                        <skinnyWars>false</skinnyWars>
                                        <filtering>true</filtering>
                                        <modules>
                                                <webModule>
                                                        <groupId>net.isban</groupId>
                                                        <artifactId>poc-war</artifactId>
                                                        <contextRoot>/poc</contextRoot>
                                                </webModule>
                                        </modules>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

</project>
Essex Boy
  • 7,565
  • 2
  • 21
  • 24
  • Hey, I created 2 simple maven projects. One packaging pom and the other ear. And 1 maven-archtype-webapp project. Then I copy the ear project and the war project into the parent project and modifiy the pom.xml. It works fine. But after the copy pase the webapp projetct doesnt have the same folder like Librarys,Java Resources Javascript Resurces. So I guess there is a better way to do this in eclipse? – SamuelTJackson May 12 '16 at 12:21
  • skinnyWars decides where all the libraries go, in this case it's set to true so all the jib jars are in the war file. If you set to false they will be in the ear. Personally I like them in the war. – Essex Boy May 13 '16 at 10:09