2

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
Omen
  • 43
  • 1
  • 2
  • 9
  • Seems there is an error with my code formatting but I can't find why, so if any moderator could edit it would be great, thanks. – Omen Jan 07 '14 at 12:33
  • Could you post the stack trace (re-run with `mvn -e`)? – Michael Ekstrand Jan 07 '14 at 21:24
  • Thank you Michael, how can I see the stack trace from netbeans? I tried to set mvn -e at the run options of my project but nothing has changed in the output. – Omen Jan 07 '14 at 22:18

2 Answers2

1

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).
Michael Ekstrand
  • 28,379
  • 9
  • 61
  • 93
  • So, if I get this right, I have to create a custom goal that would run the `lenskit-analyze` goal to use the second option? I'm confused because there is no goal defined in my project. – Omen Jan 08 '14 at 00:39
  • 1
    @omen The lenskit-eval-maven-plugin defines the `lenskit-analyze` phase as part of the LensKit lifecycle, and by default runs the LensKit evaluator on the `lenskit-eval` phase (which comes before `lenskit-analyze`. So you just need to run `mvn lenskit-analyze`, instead of e.g. `mvn install`; NetBeans' Maven runner should have a way to specify the goal/phase to run. The phase is already defined by the fact that you use the LensKit Maven plugin. – Michael Ekstrand Jan 08 '14 at 14:49
  • @ Michael Ekstrand Thank you! Understood. May I ask something else instead of creating a new thread? I tested the evaluator in `IntelliJ` running the `lenskit-analyze` phase but I get an error `error: try-with-resources is not supported in -source 1.6` referring in two java files I have created in the project. The confusing part is that I have set the `jdk` version to `1.7` and the `Project language level` to `7.0` in the Project Structure settings. Am I doing something wrong? – Omen Jan 08 '14 at 15:23
  • @ Michael Ekstrand Ignore my previous comment,somehow the source and target configuration of the `org.apache.maven.plugins` was still set to`1.6`.Nevertheless, the build fails with an error: `Failed to execute goal org.grouplens.lenskit:lenskit-eval-maven-plugin:2.0.5:run-eval (default-run-eval) on project:Execution default-run-eval of goal org.grouplens.lenskit:lenskit-eval-maven-plugin:2.0.5:run-eval failed: java.lang.RuntimeException: GroupLens data license not acknoweldged->[Help 1]`.Excuse me for asking something not relevant to the first post,but you are the best to know from first hand! – Omen Jan 08 '14 at 15:42
  • @Omen, see https://github.com/grouplens/lenskit/wiki/ML100K. This is no longer needed in LensKit 2.1 (currently under development). Also, for more detailed questions about config setup, it might be good to ask on the mailing list (see http://lenskit.grouplens.org) – Michael Ekstrand Jan 08 '14 at 17:38
  • @ Michael Ekstrand Okay, thanks a lot. I would check these and will use the mailing list with other questions about the evaluator and so... – Omen Jan 08 '14 at 18:04
0

add path to R on config.xml such on

https://github.com/grouplens/lenskit/wiki/DevOnWindows#wiki-setting-up-maven