[
https://jira.codehaus.org/browse/MNG-5543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=336823#comment-336823
]
John Farrelly commented on MNG-5543:
------------------------------------
It appears that the NoClassDefFoundError only happens if the email server is
still starting when maven enters the post-integration-test phase - which is why
I don't get an exception when I have a sleep as the integration-test. It's
strange that I don't get this error with maven < 3.1.1, but I wouldn't class
this as a bug, since in a real-world scenario the integration-test phase should
be long enough for my emailserver to start.
> NoClassDefFoundError when using executions in maven
> ---------------------------------------------------
>
> Key: MNG-5543
> URL: https://jira.codehaus.org/browse/MNG-5543
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Integration Tests
> Affects Versions: 3.1.1
> Environment: Apache Maven 3.1.1
> (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 16:22:22+0100)
> Maven home: /opt/apache-maven
> Java version: 1.7.0_45, vendor: Oracle Corporation
> Java home: /opt/jdk1.7.0_45/jre
> Default locale: en_IE, platform encoding: UTF-8
> OS name: "linux", version: "3.11.0-13-generic", arch: "amd64", family: "unix"
> Reporter: John Farrelly
>
> *I've created the smallest maven POM file I can to highlight the problem (see
> below)*.
> I'm using an email server plugin (for integration testing). I can launch the
> plugin no problem:
> {noformat}
> mvn emailserver:run
> [INFO] --- emailserver-maven-plugin:1.1.1:run (default-cli) @ project ---
> [INFO] Starting Greenmail mail server...
> [INFO] Started Greenmail mail server
> [INFO] Waiting for command from client
> {noformat}
> However, I have configured the plugin to run before the `integration-test`
> lifecycle. When run this way, I get a `NoClassDefFoundError`:
> {noformat}
> mvn integration-test
> Exception in thread "Thread-1" java.lang.NoClassDefFoundError:
> com/icegreen/greenmail/util/ServerSetup
> {noformat}
> When I execute maven with `-X` to see what's happening, in both cases it
> shows the same dependency tree as far as I can see, so I'm at a bit of a loss
> as to why I'm getting an exception which it's launched through lifecycle
> phases. Hopefully someone can help!
> {code: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/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.mytest</groupId>
> <artifactId>project</artifactId>
> <packaging>jar</packaging>
> <version>1.0</version>
> <name>Test Project</name>
> <build>
> <plugins>
> <plugin>
> <groupId>com.btmatthews.maven.plugins</groupId>
> <artifactId>emailserver-maven-plugin</artifactId>
> <configuration>
> <monitorKey>emailserver</monitorKey>
> <monitorPort>10025</monitorPort>
> <serverName>greenmail</serverName>
> <portOffset>13000</portOffset>
> <useSSL>false</useSSL>
> </configuration>
> <executions>
> <execution>
> <id>run-mail</id>
> <goals>
> <goal>run</goal>
> </goals>
> <phase>pre-integration-test</phase>
> <configuration>
> <daemon>true</daemon>
> </configuration>
> </execution>
> <execution>
> <id>stop-mail</id>
> <goals>
> <goal>stop</goal>
> </goals>
> <phase>post-integration-test</phase>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
> {code}
> {noformat}
> Maven information:
> > mvn -v
> Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17
> 16:22:22+0100)
> Maven home: /opt/apache-maven
> Java version: 1.7.0_45, vendor: Oracle Corporation
> Java home: /opt/jdk1.7.0_45/jre
> Default locale: en_IE, platform encoding: UTF-8
> OS name: "linux", version: "3.11.0-13-generic", arch: "amd64", family:
> "unix"
> {noformat}
> *NOTE*
> This appears to be a problem on 3.1.1 only. I downloaded 3.0.5 and it worked
> as expected.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira