[ 
https://issues.apache.org/jira/browse/HADOOP-9290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13639472#comment-13639472
 ] 

Arpit Agarwal commented on HADOOP-9290:
---------------------------------------

Hi Chris,

I spent some time on this back in Feb. As you have discovered Maven makes this 
hard to solve. The problem with my attached patch is that it requires the build 
to be invoked from the root directory.

Here are my notes from then with a few other things I tried:

# Setting a relative path starting with ${basedir}. This did not work because 
the other projects evaluate basedir independently so depending on the level of 
nesting this does not work. e.g. 
${basedir}/../../hadoop-common-project/hadoop-common/target/native/urs/local/lib
 works for HDFS tests but not for mapreduce tests. This is what you have just 
discovered too.
# Using 
${session.executionRootDirectory}/hadoop-common-project/hadoop-common/target/native/urs/local/lib
 works if the build is called from the root directory but fails otherwise.
# Exporting the setting into a build.properties file via the root pom.xml using 
the Properties-maven-plugin. This causes a chicken and egg problem since the 
sub-projects do not know where to read the build.properties file from.
# profiles.xml would have worked but it has been deprecated for Maven 3.
# Setting a system property via the Properties-maven-plugin plugin but system 
properties are not exported to child projects.


The simplest solution which just works is to add duplicate entries in the path 
for different levels of nesting (2-4 should do the trick I think). i.e.
{code}
-                
<PATH>${env.PATH};${basedir}/../../hadoop-common-project/hadoop-common/target/bin</PATH>
+                
<PATH>${env.PATH};${basedir}/../../hadoop-common-project/hadoop-common/target/bin;${basedir}/../../../hadoop-common-project/hadoop-common/target/bin;${basedir}/../../../../hadoop-common-project/hadoop-common/target/bin</PATH>
{code}

I am not sure if it is better or worse than requiring overrides in individual 
pom files.
                
> Some tests cannot load native library
> -------------------------------------
>
>                 Key: HADOOP-9290
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9290
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: build, native
>    Affects Versions: 3.0.0, trunk-win
>            Reporter: Arpit Agarwal
>            Assignee: Arpit Agarwal
>         Attachments: HADOOP-9290.patch
>
>
> Some tests are unable to load the native DLL on Windows. The culprit appears 
> to be an incorrect PATH configuration for the native-win profile in 
> hadoop-project/pom.xml.
> {code:xml}
>     <profile>
>       <id>native-win</id>
>       <activation>
>         <os>
>           <family>Windows</family>
>         </os>
>       </activation>
>       <build>
>         <plugins>
>           <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-surefire-plugin</artifactId>
>             <configuration>
>               <environmentVariables>
>                 <!-- Specify where to look for the native DLL on Windows -->
>                 
> <PATH>${env.PATH};${basedir}\..\..\hadoop-common-project\hadoop-common\target\bin;</PATH>
>               </environmentVariables>
>             </configuration>
>           </plugin>
>         </plugins>
>       </build>
>     </profile>
> {code}
> This is evaluated independently by each project and the relative path is not 
> always correct.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to