Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5543

NoClassDefFoundError when using executions in maven

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.1.1
    • None
    • Integration Tests
    • None

    Description

      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:

          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
      

      However, I have configured the plugin to run before the `integration-test` lifecycle. When run this way, I get a `NoClassDefFoundError`:

          mvn integration-test
          Exception in thread "Thread-1" java.lang.NoClassDefFoundError: com/icegreen/greenmail/util/ServerSetup
      

      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!

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

      NOTE
      This appears to be a problem on 3.1.1 only. I downloaded 3.0.5 and it worked as expected.

      Attachments

        Activity

          People

            Unassigned Unassigned
            johnnyleitrim John Farrelly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: