Bug 45635 - Maven local repository location hard coded in pom test phase
Summary: Maven local repository location hard coded in pom test phase
Status: RESOLVED FIXED
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.2
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-15 06:00 UTC by Philippe Haution
Modified: 2008-08-15 15:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.