LensKit: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli)

StackOverflow https://stackoverflow.com/questions/20971599

  •  25-09-2022
  •  | 
  •  

Domanda

I am building a maven project in Netbeans using LensKit recommender, but when I try to run a groovy file I get the following error:

[exec:exec]
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: config for class: eval.eval
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at eval.eval.run(eval.groovy:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1076)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:848)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:831)
at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:407)
at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at eval.eval.main(eval.groovy)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.681s
Finished at: Tue Jan 07 13:30:37 EET 2014
Final Memory: 18M/179M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project CF_Lenskit: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My POM.xml contains the following

<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>gr.hua.dit</groupId>
  <artifactId>CF_Lenskit</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lenskit.eval.scriptDir>${basedir}/src/eval/</lenskit.eval.scriptDir>
<lenskit.eval.dataDir>${basedir}/target/data/</lenskit.eval.dataDir>
<lenskit.eval.analysisDir>${basedir}/target/analysis/</lenskit.eval.analysisDir>
<lenskit.eval.publishDir>${basedir}/src/paper/</lenskit.eval.publishDir>

<lenskit.version>2.0.5</lenskit.version>
<rscript.executable>Rscript</rscript.executable>
<!-- <grouplens.mldata.acknowledge>no</grouplens.mldata.acknowledge> -->
</properties>
<dependencies>
 <dependency>
  <groupId>org.grouplens.lenskit</groupId>
  <artifactId>lenskit-core</artifactId>
  <version>${lenskit.version}</version>
 </dependency>
 <dependency>
  <groupId>org.grouplens.lenskit</groupId>
  <artifactId>lenskit-knn</artifactId>
  <version>${lenskit.version}</version>
 </dependency>
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
 </dependency>
 <dependency>
  <groupId>org.hamcrest</groupId>
  <artifactId>hamcrest-library</artifactId>
  <version>1.3</version>
  <scope>test</scope>
 </dependency>
 <dependency>
  <artifactId>groovy-all</artifactId>
  <groupId>org.codehaus.groovy</groupId>
  <version>2.0.5</version>
 </dependency>
 <dependency>
  <groupId>org.grouplens.lenskit</groupId>
  <artifactId>lenskit-eval-maven-plugin</artifactId>
  <version>2.0.5</version>
 </dependency>
 <dependency>
  <groupId>org.grouplens.lenskit</groupId>
  <artifactId>lenskit-eval</artifactId>
  <version>2.0.5</version>
 </dependency>
 <dependency>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
 </dependency>  
 </dependencies>



<build>
 <plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
     <configuration>
      <source>1.7</source>
      <target>1.7</target>
     </configuration>
  </plugin>
  <plugin>
    <artifactId>lenskit-eval-maven-plugin</artifactId>
    <groupId>org.grouplens.lenskit</groupId>
    <version>${lenskit.version}</version>
    <extensions>true</extensions>
     <configuration>
      <script>${lenskit.eval.scriptDir}/eval.groovy</script>
      <analysisScript>${lenskit.eval.scriptDir}/chart.R</analysisScript>
       <targets>
        <target>draw</target>
        <target>analyze</target>
      </targets>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>latex-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution>
        <id>do-latex</id>
        <phase>lenskit-publish</phase>
        <goals>
          <goal>latex</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-eclipse-compiler</artifactId>
        <version>2.6.0-01</version>
      </dependency>
    </dependencies>
    <configuration>
      <compilerId>groovy-eclipse-compiler</compilerId>
    </configuration>
  </plugin>
  <plugin>
    <artifactId>groovy-eclipse-compiler</artifactId>
    <groupId>org.codehaus.groovy</groupId>
    <version>2.6.0-01</version>
    <extensions>true</extensions>
  </plugin>
  </plugins>
  </build>
</project>

Can you suggest any solution?
Please let me know if I need to post any other info.

Update!
Okay then, I have updated the first error message and below is the stack trace of the exception:

    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project CF_Lenskit: Command execution failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution failed.
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:362)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:610)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:352)
... 21 more
È stato utile?

Soluzione

It looks like NetBeans is using the Codehaus exec-maven-plugin under the hood to run the LensKit eval.groovy file directly as a Groovy script. LensKit eval scripts cannot be run directly as Groovy scripts, they must be run using the LensKit evaluator.

There are two ways to do this:

  • Use the evaluator command-line interface, either with the lenskit-eval script in the binary distribution or running the org.grouplens.lenskit.eval.cli.EvalCLI class from NetBeans.
  • Use the lenskit-eval-maven-plugin. Your POM is set up to do this already; what you will do for this option is to run the lenskit-analyze Maven goal (NetBeans should have a way to run arbitrary Maven goals/phases).

Altri suggerimenti

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top