NoClassDefFoundError when running avro-maven-plugin:protocol goal
-----------------------------------------------------------------

                 Key: AVRO-868
                 URL: https://issues.apache.org/jira/browse/AVRO-868
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.5.2
         Environment: Apache Maven 3.0.3, Java 1.6.0_26, Avro 1.5.2-rc1  
(experienced on multiple OSes so don't think that's important)
            Reporter: Alex Miller
            Priority: Blocker


I have a project that generates Java classes from a avpr using the 
avro-maven-plugin's protocol goal.  When I switch from Avro 1.5.1 (everything 
works perfectly) to 1.5.2-rc1 (also happened with rc0), I get the following 
error:

Caused by: org.apache.maven.plugin.PluginContainerException: A
required class was missing while executing
org.apache.avro:avro-maven-plugin:1.5.2:protocol:
org/apache/maven/shared/model/fileset/util/FileSetManager
-----------------------------------------------------
realm =    plugin>org.apache.avro:avro-maven-plugin:1.5.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = 
file:/Users/alex/.m2/repository/org/apache/avro/avro-maven-plugin/1.5.2/avro-maven-plugin-1.5.2.jar
urls[1] = 
file:/Users/alex/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:125)
        ... 20 more
Caused by: java.lang.NoClassDefFoundError:
org/apache/maven/shared/model/fileset/util/FileSetManager
        at 
org.apache.avro.mojo.AbstractAvroMojo.getIncludedFiles(AbstractAvroMojo.java:113)
        at 
org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo.java:97)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        ... 20 more
Caused by: java.lang.ClassNotFoundException:
org.apache.maven.shared.model.fileset.util.FileSetManager
        at 
org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
        at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
        ... 23 more

It appears to me that there is a missing dependency on the
FileSetManager class (which is in the
org.apache.maven.shared:file-management artifact).

My plugin execution is pretty straightforward, just generating sources
from the avpr:

      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <version>${avro-version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>protocol</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

You can find the project in question in the sherpa-protocol sub-module at 
https://github.com/revelytix/spark.  To reproduce:

1) git clone git://github.com/revelytix/spark.git
2) cd spark/sherpa-protocol
3) In pom.xml, change: 
  a) <avro-version>1.5.1</avro-version> to 1.5.2
  b) Add repositories section: 
 
      <repositories>
        <repository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>avro-rc</id>
          <name>Avro RC</name>
          
<url>https://repository.apache.org/content/repositories/orgapacheavro-010</url>
        </repository>
      </repositories>

4) mvn -X -e compile

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to