[ 
https://issues.apache.org/jira/browse/HAMA-871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Illecker updated HAMA-871:
---------------------------------

    Attachment: HAMA-871.patch

I used the *gmaven-plugin* to set system properties because I needed a global 
property for the Hama Pipes native build folder.
Our module *hama-pipes* \[1] compiles the native code and sets its install path 
to a system property.
Later this system property is evaluated by the *core* module \[2] and assigned 
to the *surfire-plugin*, because the test case o.a.h.p.TestPipes needs the 
install path of the native code.

Maybe there exists a better solution to share properties among modules, but 
only this one worked for me.

The reason for your NullPointerException is that you are not building 
*hama-pipes* before the *core* module and therefore the Hama Pipes native build 
folder system property does not exists. A simple NullPointer check will solve 
it.

Please see the attached patch. Sorry for any inconvenience!

\[1] hama-pipes/pom.xml
{code}
<plugin>
  <groupId>org.codehaus.groovy.maven</groupId>
  <artifactId>gmaven-plugin</artifactId>
  <version>1.0</version>
  <executions>
    <execution>
      <phase>process-test-resources</phase>
      <goals><goal>execute</goal></goals>
      <configuration>
        <source>
          System.setProperty("hama.pipes.examples.install", 
project.properties['ant.hama.pipes.examples.install']);
        </source>
      </configuration>
    </execution>
  </executions>
</plugin>
{code}

\[2] core/pom.xml
{code}
<plugin>
  <groupId>org.codehaus.groovy.maven</groupId>
  <artifactId>gmaven-plugin</artifactId>
  <version>1.0</version>
  <executions>
    <execution>
      <phase>process-test-resources</phase>
      <goals><goal>execute</goal></goals>
      <configuration>
        <source>
          project.properties.setProperty('hama.pipes.examples.install', 
System.getProperty("hama.pipes.examples.install"));
        </source>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <systemPropertyVariables>
      
<hama.pipes.examples.install>${hama.pipes.examples.install}</hama.pipes.examples.install>
    </systemPropertyVariables>
  </configuration>
</plugin>
{code}

> NPE when building core module due to gmaven-plugin. 
> ----------------------------------------------------
>
>                 Key: HAMA-871
>                 URL: https://issues.apache.org/jira/browse/HAMA-871
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp core
>    Affects Versions: 0.7.0
>         Environment: maven 3.0.5 (as described in 
> https://wiki.apache.org/hama/GettingStarted)
> Java version: 1.6.0_25
>            Reporter: ChiaHung Lin
>            Priority: Minor
>         Attachments: HAMA-871.patch
>
>
> When testing with a command `mvn -f core/pom.xml clean install 
> -Dtest=<TestCase>`, maven complains NPE as below
> {code}
> Caused by: java.lang.NullPointerException
>       at java.util.Hashtable.put(Hashtable.java:394)
>       at 
> org.codehaus.groovy.maven.plugin.execute.GroovyMavenProjectAdapter$EvaluatingProperties.put(GroovyMavenProjectAdapter.java:162)
>       at java.util.Properties.setProperty(Properties.java:143)
> {code}
> It looks like groovy-plugin raise the issue. 
> {code}
>         <groupId>org.codehaus.groovy.maven</groupId>
>         <artifactId>gmaven-plugin</artifactId>
>         <version>1.0</version>
> {code}
> But changing to v1.4 or other version, found at 
> http://docs.codehaus.org/display/GMAVEN/Home, shows that standard maven 
> repository doesn't have those version.
> {code}
> Could not find artifact org.codehaus.groovy.maven:gmaven-plugin:pom:1.1 in 
> central (http://repo.maven.apache.org/maven2)  
> {code}
> This doesn't block the compilation actually, because compilation process can 
> be done via `mvn clean install` without a problem. 
> BTW, it seems that gmaven is discontinued. 
> {code}
> GMaven provides integration of Groovy into Maven. This project has been 
> discontinued since the structure doesn't work well with how Groovy's 
> invokedynamic releases.
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to