Bug 45635

Summary: Maven local repository location hard coded in pom test phase
Product: Log4j - Now in Jira Reporter: Philippe Haution <philippe.haution>
Component: OtherAssignee: log4j-dev <log4j-dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.2   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Philippe Haution 2008-08-15 06:00:51 UTC
The maven test phase calls the unit tests through a maven-antrun-plugin, with all necessary jars picked up in the default local repository ${user.home}/.m2/repository :

...
<execution>
  <phase>test</phase>
  <id>runAll</id>
  <configuration>
    <tasks>
      <ant dir="tests" target="runAll">
        <property name="junit.jar" location="${user.home}/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar" />
        <property name="jakarta.oro.jar" location="${user.home}/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar" />
...

If the maven repository is not in this standard location, this will make an mvn test fail because these jars cannot be found. It would be better if those jars location was based on a m2_repo property (already available in tests/build.xml) that the user could customize with a 
$ mvn -Dm2_repo=<local maven repository> test :

...
<ant dir="tests" target="runAll">
  <property name="m2_repo" location="${user.home}/.m2/repository"/>
  <property name="junit.jar" location="${m2_repo}/junit/junit/3.8.1/junit-3.8.1.jar" />
  <property name="jakarta.oro.jar" location="${m2_repo}/oro/oro/2.0.8/oro-2.0.8.jar" />
Comment 1 Curt Arnold 2008-08-15 15:51:53 UTC
I committed a change in rev 686411 that does seem to work for me.  I dropped passing the jar locations and just passed the m2_repo to tests.xml and added a default value for m2_repo into the profiles.  I think your patch would have required all users to specify -Dm2_repo even if they had the repository at the default location.