Bug 45635 - Maven local repository location hard coded in pom test phase
Maven local repository location hard coded in pom test phase
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Other
1.2
All All
: P2 normal
: ---
Assigned To: log4j-dev
:
Depends on:
Blocks:
  Show dependency tree
 
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.