Bug 1011548

Summary: M2 Repo: artifact version from property causes badly named artifact
Product: [Retired] JBoss BRMS Platform 6 Reporter: Zuzana Krejčová <zkrejcov>
Component: Business CentralAssignee: manstis
Status: CLOSED CURRENTRELEASE QA Contact: Zuzana Krejčová <zkrejcov>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0CC: etirelli, kverlaen, lpetrovi, mbaluch, mwinkler, vigoyal
Target Milestone: ER1   
Target Release: 6.0.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Uploading a Maven project jar with the version defined by a property results in a malformed artifact name and wrong artifact version. Cause: Consequence: Fix: Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 19:58:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
screenshot none

Description Zuzana Krejčová 2013-09-24 14:02:08 UTC
Created attachment 802260 [details]
screenshot

Description of problem:
Maven projects can have their version defined by a Maven property:
...
<version>${property_version}</version>
...
<properties>
  <property_version>1.0</property_version>
</properties>
...

Uploading a Maven project jar with version defined this way results in a malformed artifact name and wrong artifact version. The above example is taken from my test project. Maven compiles this just fine. Uploading it creates an artifact named 'testUploadPropertyVersion-$%7Bproperty_version%7D.jar' - see screenshot. In the repository, the artifact is stored under version '$%7Bproperty_version%7D' as well. Adding the jar as dependency to a project adds this to the project pom.xml:
<dependency>
  <groupId>org.jboss.qa.full</groupId>
  <artifactId>testUploadPropertyVersion</artifactId>
  <version>${property_version}</version>
</dependency>

This is fine until you decide to add a Maven property to your project pom.xml and accidentally name it the same as the property in the uploaded jar's pom.xml.
Or better yet - try to keep more versions of a project with version kept in a property.
In both above cases, it just won't work. The first will search for a non-existent version of the jar, in the second case, the jar will simply be rewritten by the last uploaded version.


Version-Release number of selected component (if applicable):
BPMS 6.0 ER3

Comment 4 Jervis Liu 2013-10-10 07:04:43 UTC
Fixed. 
Tested with this pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<properties>
  <property_version>1.0</property_version>
</properties>
  <modelVersion>4.0.0</modelVersion>
  <groupId>a</groupId>
  <artifactId>b</artifactId>
  <version>${property_version}</version>
</project>

Comment 6 Zuzana Krejčová 2013-12-04 15:21:10 UTC
The list of artifacts in Artifact repository perspective and the modal window for adding dependencies from repository (in Project editor) is fixed.

Adding the jar as dependency to a project adds this to the project pom.xml:
<dependency>
  <groupId>org.jboss.qa.full</groupId>
  <artifactId>testUploadPropertyVersion</artifactId>
  <version>${property_version}</version>
</dependency>
Also, the list of dependencies in Project editor - Dependencies still shows "${property_version}" as the so-called Version ID.

Comment 8 manstis 2014-02-03 14:12:28 UTC
GroupID, ArtifactID and Version are now retrieved from pom.properties (that is generated by Maven).

For JARs that are uploaded without a pom.xml or pom.properties (i.e. JARs not created by Maven) the user is (still) prompted for GroupID, ArtifactID and Version and both a pom.xml and pom.properties files generated. This means, for older non-Maven JARs that were uploaded to old versions of BPMS/BRMS a pom.properties file may not exist. 

The user should re-upload these JARs to create the pom.properties file.

Comment 9 Lukáš Petrovický 2014-02-07 16:19:30 UTC
This no longer has a target release of 6.0.0.