I am trying to write a plugin that will generate source code prior to
compilation, but the plugin fails when it gets called.

The plugin looks like this:

/**
 * @phase generate-sources
 * @goal bean
 * @author mpryor
 *
 */
public class ProtegeBeanGeneratorMojo extends AbstractGeneratorMojo {

    /**
     * @parameter expression="${project.build.directory}/generated-sources"
     * @required
     */
    protected File outputDirectory;
[snip]
}

POM snippet 

<project>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>intermedi8-parent</artifactId>
    <groupId>net.mobiquity</groupId>
    <version>0.1-SNAPSHOT</version>
  </parent>
  <artifactId>intermedi8-protege-plugin</artifactId>
  <version>0.1-SNAPSHOT</version>
  <packaging>maven-plugin</packaging>
  <name>Intermedi8 Protege Plugin</name>
  <dependencies>

It builds and installs fine, with what appears to be a well formed
plugin.xml:

<plugin>
  <groupId>net.mobiquity</groupId>
  <artifactId>intermedi8-protege-plugin</artifactId>
  <isolatedRealm>true</isolatedRealm>
  <mojos>
    <mojo>
      <id>protege:bean</id>
      <requiresDependencyResolution>runtime</requiresDependencyResolution>
      <phase>generate-sources</phase>
      <executePhase>generate-sources</executePhase>
 
<implementation>net.mobiquity.intermedi8.tools.protege.ProtegeBeanGeneratorM
ojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <parameters>
        <parameter>
[snip]

I have another project that uses the plugin, configured like this:


  <build>
        <plugins>
                <plugin>
                <groupId>net.mobiquity</groupId>
                <artifactId>intermedi8-protege-plugin</artifactId>
                <version>0.1-SNAPSHOT</version>
                <configuration>
        
<protogeProject>${maven.src.dir}/ontology/intermedi8.pprj/</protogeProject>
                </configuration>
                </plugin>
        </plugins>

But the build fails with the following :

C:\proj\682\apps\intermedi8\intermedi8-core>m2 -X -e install
[INFO] intermedi8-parent: using locally installed snapshot
[INFO]
----------------------------------------------------------------------------
[INFO] Building Intermedi8 Core
[INFO]
----------------------------------------------------------------------------
[INFO] maven-jar-plugin: using locally installed snapshot
[INFO] maven-archiver: using locally installed snapshot
[INFO] maven: using locally installed snapshot
[INFO] intermedi8-protege-plugin: using locally installed snapshot
[INFO] maven-resources-plugin: using locally installed snapshot
[INFO] maven-compiler-plugin: using locally installed snapshot
[INFO] plexus-compiler-api: using locally installed snapshot
[INFO] plexus-compiler: using locally installed snapshot
[INFO] plexus-compiler-javac: using locally installed snapshot
[INFO] plexus-compilers: using locally installed snapshot
[INFO] maven-surefire-plugin: using locally installed snapshot
[INFO] maven-install-plugin: using locally installed snapshot
---------------------------------------------------
constituent[0]: file:/C:/dev/maven/m2dev/lib/commons-cli-1.0-beta-2.jar
constituent[1]: file:/C:/dev/maven/m2dev/lib/maven-artifact-2.0-SNAPSHOT.jar
constituent[2]: file:/C:/dev/maven/m2dev/lib/maven-core-2.0-SNAPSHOT.jar
constituent[3]: file:/C:/dev/maven/m2dev/lib/maven-model-2.0-SNAPSHOT.jar
constituent[4]: file:/C:/dev/maven/m2dev/lib/maven-monitor-2.0-SNAPSHOT.jar
constituent[5]:
file:/C:/dev/maven/m2dev/lib/maven-plugin-api-2.0-SNAPSHOT.jar
constituent[6]:
file:/C:/dev/maven/m2dev/lib/maven-plugin-descriptor-2.0-SNAPSHOT.jar
constituent[7]: file:/C:/dev/maven/m2dev/lib/maven-project-2.0-SNAPSHOT.jar
constituent[8]: file:/C:/dev/maven/m2dev/lib/maven-settings-2.0-SNAPSHOT.jar
constituent[9]:
file:/C:/dev/maven/m2dev/lib/plexus-container-artifact-1.0-alpha-3-SNAPSHOT.
jar
constituent[10]: file:/C:/dev/maven/m2dev/lib/plexus-i18n-1.0-beta-3.jar
constituent[11]:
file:/C:/dev/maven/m2dev/lib/wagon-http-lightweight-1.0-alpha-3-SNAPSHOT.jar
constituent[12]:
file:/C:/dev/maven/m2dev/lib/wagon-provider-api-1.0-alpha-3-SNAPSHOT.jar
---------------------------------------------------
java.lang.NullPointerException: version was null for
org.apache.maven.plugins:maven-protege-plugin
        at
org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.jav
a:246)
        at
org.apache.maven.artifact.DefaultArtifact.getId(DefaultArtifact.java:159)
        at
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultAr
tifactResolver.java:77)
        at
org.codehaus.plexus.DefaultArtifactEnabledContainer.addComponent(DefaultArti
factEnabledContainer.java:104)
        at
org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.
java:282)
        at
org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManag
er.java:241)
        at
org.apache.maven.plugin.DefaultPluginManager.verifyPluginForGoal(DefaultPlug
inManager.java:195)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeMojo(DefaultLifec
ycleExecutor.java:478)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executePhase(DefaultLife
cycleExecutor.java:436)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.processGoals(DefaultLife
cycleExecutor.java:164)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:94)
        at
org.apache.maven.DefaultMaven.processProject(DefaultMaven.java:222)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:136)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:217)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:303)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:243)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:416)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:363)


Any clues as to what I have done wrong ?

Thanks,
Matthew


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to