That is odd... does the account you're running mvn on have read access to
that file? Is the file locked by an external program? Is the file still
there (since its in a temp directory)? "file.toURL().openStream()" is
throwing an IOException, so it looks to be a Java thing.

Thanks;
Eric

On 7/14/06, Alexander Hars <[EMAIL PROTECTED]> wrote:

Hi,

I am getting a strange error when I try to  create the simple Maven
Hello Plugin example. When compiling it, I get the message:  "Cannot
read file: GreetingMojo.java" (Detailed error message is below).

I don't get any error when I just change the <packaging> from
maven-plugin to jar.

Any ideas what the issue could be?

Thanks for your help!
-Alexander

I copied the examples from the Maven2 documentation:
GreetingMojo.java:

----------------------------------------------------------------------------
package sample;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

/**
* @goal sayhi
* @description Says "Hi" to the user
*/
public class GreetingMojo extends AbstractMojo
{
    public void execute() throws MojoExecutionException
    {
        getLog().info("Hello, world.");
    }
}

--------------------------------------------------------------------------
pom.xml:
-------------------------------------------------------------------------
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>sample.plugin</groupId>
  <artifactId>maven-hello-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Sample Parameter-less Maven Plugin</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0</version>
    </dependency>
  </dependencies>
</project>


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



C:\D\test\temp>mvn compile
[INFO] Scanning for projects...
[INFO]
-------------------------------------------------------------------------
---
[INFO] Building Sample Parameter-less Maven Plugin
[INFO]    task-segment: [compile]
[INFO]
-------------------------------------------------------------------------
---
[INFO] [plugin:descriptor]
[INFO] Using 2 extractors.
[INFO] Applying extractor for language: java
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Cannot read file : GreetingMojo.java
[INFO]
------------------------------------------------------------------------
[INFO] Trace
java.lang.RuntimeException: Cannot read file : GreetingMojo.java
        at
com.thoughtworks.qdox.JavaDocBuilder$1.visitFile(JavaDocBuilder.java:
369)
        at
com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(Directory
Scanner.java:43)
        at
com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(Directory
Scanner.java:34)
        at
com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(Directory
Scanner.java:34)
        at
com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(Directory
Scanner.java:52)
        at
com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.jav
a:362)
        at
org.apache.maven.tools.plugin.extractor.java.JavaMojoDescriptorExtrac
tor.execute(JavaMojoDescriptorExtractor.java:477)
        at
org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePlug
inDescriptor(DefaultMojoScanner.java:69)
        at
org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(Abstract
GeneratorMojo.java:99)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:412)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:534)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:475)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:454)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:306)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:273)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:140)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Fri Jul 14 17:54:06 CEST 2006
[INFO] Final Memory: 3M/8M
[INFO]
------------------------------------------------------------------------



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




--
Eric
http://codehaus.org/~eredmond

Reply via email to