Maven 2 & 3

Wrong path for artifacts with system scope

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0.5
  • Component/s: Plugins and Lifecycle
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    1

Description

For system dependencies artifact.getFile() returns a wrong file. While dependency.getSystemPath() correctly returns the user-set path, artifact.getPath always returns the path in the local repository.

For example a dependency with system path = "/test.jar" will result in:
dependency.getSystemPath() = /test.jar
artifact.getFile().getAbsolutePath()= M2_REPO/groupid/artifactid/version/artifactid-1.0.jar

Issue Links

Activity

Hide
John Casey added a comment -

is this a problem with the eclipse plugin??

Show
John Casey added a comment - is this a problem with the eclipse plugin??
Hide
John Casey added a comment -

I just tested this with a (somewhat) out-of-date 2.0-beta-3-SNAPSHOT build of the maven-eclipse-plugin, and from what I could tell of the .classpath file, the system dependency was resolved to the correct file.

I'll wait a couple of days to see if anyone else can contradict the results I produced, then close it FIXED.

My POM:

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it</groupId>
<artifactId>mng-1379</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>java</groupId>
<artifactId>tools</artifactId>
<version>1.4</version>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
<scope>system</scope>
</dependency>
</dependencies>
</project>

Show
John Casey added a comment - I just tested this with a (somewhat) out-of-date 2.0-beta-3-SNAPSHOT build of the maven-eclipse-plugin, and from what I could tell of the .classpath file, the system dependency was resolved to the correct file. I'll wait a couple of days to see if anyone else can contradict the results I produced, then close it FIXED. My POM: <project> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.it</groupId> <artifactId>mng-1379</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>java</groupId> <artifactId>tools</artifactId> <version>1.4</version> <systemPath>${java.home}/../lib/tools.jar</systemPath> <scope>system</scope> </dependency> </dependencies> </project>
Hide
fabrizio giustina added a comment -

The eclipse plugin in svn has been modified by replacing the path for system-scope artifacts with the path returned by dependency.getSystemPath().

You can check if everything is ok by getting the latest version from svn and commenting out the content of the fixSystemScopeArtifacts() method in EclipseUtils. Test #8 is related to this bug.
Has this been fixed in maven core? Which revision?

Show
fabrizio giustina added a comment - The eclipse plugin in svn has been modified by replacing the path for system-scope artifacts with the path returned by dependency.getSystemPath(). You can check if everything is ok by getting the latest version from svn and commenting out the content of the fixSystemScopeArtifacts() method in EclipseUtils. Test #8 is related to this bug. Has this been fixed in maven core? Which revision?
Hide
fabrizio giustina added a comment -

This is still broken in the continuum m2-20051110.160001 build.
Test #8 in eclipse plugin fails when commenting out the replacement of paths for system scoped artifacts.

Show
fabrizio giustina added a comment - This is still broken in the continuum m2-20051110.160001 build. Test #8 in eclipse plugin fails when commenting out the replacement of paths for system scoped artifacts.
Hide
John Casey added a comment -

will take a glance at this before releasing...

Show
John Casey added a comment - will take a glance at this before releasing...
Hide
Edwin Punzalan added a comment -

This bug may have been fixed... attached test does not fail.

Show
Edwin Punzalan added a comment - This bug may have been fixed... attached test does not fail.
Hide
Joshua Nichols added a comment -

I'm told this has been fixed in SVN, and will be available with 2.0.5. Is 2.0.5 going to be released soon, or alternatively, is there a particular svn revision I can get a diff from, in order to backport it to 2.0.4?

I'm working with a few others on supporting building packages using maven on Gentoo Linux, and we have some ideas that rely on the system scope (Note: I mean packaging stuff that builds with maven by using portage... not just using maven for building your own projects).

Show
Joshua Nichols added a comment - I'm told this has been fixed in SVN, and will be available with 2.0.5. Is 2.0.5 going to be released soon, or alternatively, is there a particular svn revision I can get a diff from, in order to backport it to 2.0.4? I'm working with a few others on supporting building packages using maven on Gentoo Linux, and we have some ideas that rely on the system scope (Note: I mean packaging stuff that builds with maven by using portage... not just using maven for building your own projects).
Hide
Carlos Sanchez added a comment -
Show
Carlos Sanchez added a comment - You can get it from http://maven.zones.apache.org/~maven/builds/branches/
Hide
Jason van Zyl added a comment -

Several ITs for system scoped dependencies. it0063, it0085

Show
Jason van Zyl added a comment - Several ITs for system scoped dependencies. it0063, it0085

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: