0

I'm facing a weird problem and was not able to find somebody out there having the same behaviour creating a maven ear-ejb project in eclipse.

I have a parent pom that looks like this:

<modules>
    <module>ear</module>
    <module>ejb</module>
</modules>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
                <wtpversion>2.0</wtpversion>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

the pom.xml from the ejb project:

<build>
    <sourceDirectory>ejbModule</sourceDirectory>
    <resources>
        <resource>
            <directory>ejbResources</directory>
        </resource>
        <resource>
            <directory>ejbModule</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <ejbVersion>3.1</ejbVersion>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.4.RELEASE</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

and finally the pom.xml of the ear project:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <version>6</version>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <ejbModule>
                        <groupId>com.coba.test</groupId>
                        <artifactId>jms-test-ejb</artifactId>
                        <uri>jms-test-ejb.jar</uri>
                    </ejbModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>

    <dependency>
        <groupId>com.coba.test</groupId>
        <artifactId>jms-test-ejb</artifactId>
        <version>${project.version}</version>
        <type>ejb</type>
    </dependency>
</dependencies>

When running mvn eclipse:eclipse on the projects I am able to import them as existing projects and all natures and references are ok. When I run mvn clean package and deploy the ear to the server (tested on a websphere 8, jboss 7 and 8) the application (a single mdb) starts and acts as expected. BUT when I try to run the project from within eclipse no class from the shipped dependencies is found. When looking into the deployment assembly of the projects then (how it should be) all dependencies are listed in the ear project and the none of them appears in the ejb project. I had a look at the maven-eclipse-plugin and it does explicitly write the to deployed components to the ear project, so I think this is the way it should be. But when I manually add the classpath entries to the deployment assembly to the ejb project the application gets deployed and starts without any Problems.

Is this a Problem of my project setting or a maven-eclipse-plugin bug? Does anybody had this problem himself?

Thx for reading Markus

EDIT:

I dot not use the m2eclipse plugin.

markusw
  • 1,975
  • 16
  • 28
  • 1
    Do you use m2e plugin in Eclipse? If yes than stop use maven-eclipse-plugin. Furthermore follow the [default folder layout (ejb?)](https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html) why are you violating the conventions? – khmarbaise Apr 03 '14 at 12:37
  • No, I forgot to mention it. I do not use the m2eclipse plugin! I will update my question. – markusw Apr 03 '14 at 12:45
  • 1
    Why don't you use m2e ? Want it hard? – khmarbaise Apr 03 '14 at 12:50
  • We have some special maven plugins, which can not be configured properly with the lifecycle mapping. My team has no good experiences with it. Maybe I'll give it another try, but first I have to get this running. Don't you think, the wtp eclipse plugin should handle this? – markusw Apr 03 '14 at 12:56
  • You'd better use m2e, Maven Eclipse Plugin has not been updated since 2012. – apetrelli Apr 11 '14 at 08:37

0 Answers0