Lee Meador created MPMD-273:
-------------------------------

             Summary: Dependency jar with rules fails only with SNAPSHOT version
                 Key: MPMD-273
                 URL: https://issues.apache.org/jira/browse/MPMD-273
             Project: Maven PMD Plugin
          Issue Type: Bug
          Components: PMD
    Affects Versions: 3.10.0
         Environment: Jenkins scripted build job calls Maven running on RHEL 7 
Linux build agents controlled by Jenkins 2.73. Java 8.
            Reporter: Lee Meador


One build job creates a coding-standards jar containing PMD rulesets and I have 
run that build with and without SNAPSHOT for version 0.0.2. If I go to my Nexus 
GUI and search, I see the 0.0.2 version and about 8 SNAPSHOT versions with 
different dates and times. 0.0.2 is in the releases repo and 0.0.2-SNAPSHOT(s) 
are in the snapshots repo.

I have settings.xml set to point to our the public Nexus 3 repository which 
proxies to Maven Central and several other repos both open source and internal 
to our company. The releases repo is included in public. The snapshot repo is 
not included in public, this proxy repo.

This is the mirrorOf tag in settings.xml.

{{    <mirrorOf>!nexus-snapshots,*</mirrorOf>}}

For another build job, I have a <repository> tag in the pom pointing to our 
snapshot repo with snapshot enabled and releases NOT enabled. This tag is there 
to give it an id that works with the mirroring: 

{{    <id>nexus-snapshots</id>}}

Other snapshot versions of things needed when compiling the code are found by 
maven.

I configure the maven pmd plugin thusly:

{{<plugin>}}
{{   <groupId>org.apache.maven.plugins</groupId>}}
{{   <artifactId>maven-pmd-plugin</artifactId>}}
{{   <executions>}}
{{     <execution>}}
{{       <goals>}}
{{         <goal>check</goal>}}
{{       </goals>}}
{{     </execution>}}
{{   </executions>}}
{{   <configuration>}}
{{     <sourceEncoding>utf-8</sourceEncoding>}}
{{     <minimumTokens>100</minimumTokens>}}
{{     <targetJdk>1.8</targetJdk>}}
{{     <minimumPriority>3</minimumPriority>}}
{{     <failOnViolation>true</failOnViolation>}}
{{     <rulesets>}}
{{       <ruleset>pmd-config2.xml</ruleset>}}
{{     </rulesets>}}
{{   </configuration>}}
{{   <dependencies>}}
{{     <dependency>}}
{{       <groupId>com.aa.crewtech.tools</groupId>}}
{{       <artifactId>coding-standards</artifactId>}}
{{       <version>${coding-standards.version}</version>}}
{{     </dependency>}}
{{   </dependencies>}}
{{ </plugin>}}

If I run my build and the property coding-standards.version has the value 0.0.2 
everything works.

If coding-standards.version has the value 0.0.2-SNAPSHOT it fails with this 
error:

_ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-pmd-plugin:3.10.0:pmd (pmd) on project SqlTool: 
Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.10.0:pmd 
failed: Plugin org.apache.maven.plugins:maven-pmd-plugin:3.10.0 or one of its 
dependencies could not be resolved: Could not find artifact 
com.my.company:coding-standards:jar:0.0.2-SNAPSHOT in nexus 
([https://nexusread.mycompany.com/repository/public/|https://nexusread.aa.com/repository/OT-public/])
 -> [Help 1]_

All these builds actually run in my Jenkins with all the code under source 
control and its all repeatable. SNAPSHOT version for the ruleset jar fails. 
Non-SNAPSHOT version works.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to