Bug 1011548 - M2 Repo: artifact version from property causes badly named artifact
M2 Repo: artifact version from property causes badly named artifact
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
6.0.0
Unspecified Unspecified
medium Severity medium
: ER1
: 6.0.1
Assigned To: manstis
Zuzana Krejčová
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-24 10:02 EDT by Zuzana Krejčová
Modified: 2016-07-31 21:08 EDT (History)
6 users (show)

See Also:
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 15:58:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
screenshot (17.00 KB, image/png)
2013-09-24 10:02 EDT, Zuzana Krejčová
no flags Details

  None (edit)
Description Zuzana Krejčová 2013-09-24 10:02:08 EDT
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 03:04:43 EDT
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 10:21:10 EST
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 09:12:28 EST
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 11:19:30 EST
This no longer has a target release of 6.0.0.

Note You need to log in before you can comment on or make changes to this bug.