Properties in plugin poms are not resolved.
-------------------------------------------

                 Key: MNG-3881
                 URL: http://jira.codehaus.org/browse/MNG-3881
             Project: Maven 2
          Issue Type: Bug
          Components: Plugins and Lifecycle
    Affects Versions: 2.1.0-M1
         Environment: Mac ox s
            Reporter: Derek Clarkson


I'm testing a plugin I have written to run JUnit 4.x tests. The pom for this 
plug uses properties to specify the versions of dependencies. ie. 

                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>${junit.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>${slf4j.version}</version>
                </dependency>

After compiling and installing the plugin into my local repository, I then 
attempt to use in in another project. The project compiles correcly, but then 
fails when attempting to resolve the dependecies of my plugin. The faiures 
appear to be the plugins dependencies which are versioned by properties. HEre's 
an example:

6) org.slf4j:slf4j-api:jar:${slf4j.version}

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.slf4j -DartifactId=slf4j-api 
-Dversion=${slf4j.version} -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=org.slf4j -DartifactId=slf4j-api 
-Dversion=${slf4j.version} -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-DrepositoryId=[id]

  Path to dependency: 
        1) dhc.maven2:maven-junit4x-plugin:maven-plugin:0.0.3-SNAPSHOT
        2) org.slf4j:slf4j-api:jar:${slf4j.version}

I also see stack traces like this:

Caused by: java.io.FileNotFoundException: 
http://repo1.maven.org/maven2/org/apache/maven/reporting/maven-reporting-impl/${maven.reporting.version}/maven-reporting-impl-${maven.reporting.version}.jar
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1239)
        at 
org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:83)
        ... 35 more
[DEBUG] Unable to download the artifact from any repository

And ....

7 required artifacts are missing.

for artifact: 
  dhc.maven2:maven-junit4x-plugin:maven-plugin:0.0.3-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

        at 
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:482)
        at 
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:394)
        at 
org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:337)
        at 
org.apache.maven.plugin.DefaultPluginManager.getPluginArtifacts(DefaultPluginManager.java:436)
        at 
org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:279)
        at 
org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:211)
        at 
org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:186)
        at 
org.apache.maven.plugin.loader.DefaultPluginLoader.loadPlugin(DefaultPluginLoader.java:79)
        ... 20 more

Plaing around with this I found that if I go into the repository and edit the 
pom file to specify the dependency version then that dependency resolves. 

>From this I'm inclined to think that when resolving dependencies of plugins, 
>that the plugin's pom is not being processed to look for properties to be 
>inserted.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to