You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Maven install/deploy fails when we publish POM files with the predefined variables like {revision} instead of actual values to the Artifactory using the Artifactory Maven plugin.
To Reproduce
Clone a sample multi module project and update the artifacts to predefined variables (like {revision} and {sha1}) instead of actual value in the pom.xml file as shown here.
Now, clone a new maven project and add the “multi1” project (above project) as a dependency to it.
As shown below: <dependency> <groupId>org.jfrog.test</groupId> <artifactId>multi1</artifactId> <version>${revision}-${sha1}</version> </dependency>
run the maven clean install command and it results in the below error.
Sample command used : mvn clean install -Drevision=2.0.0-SNAPSHOT -Dbuildnumber=1 -Dsha1=123
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.650 s
[INFO] Finished at: 2021-04-17T20:40:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project maven-example: Could not resolve dependencies for project org.jfrog.example:maven-example:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.jfrog.test:multi1:jar:2.0.0-SNAPSHOT-123: Failed to read artifact descriptor for org.jfrog.test:multi1:jar:2.0.0-SNAPSHOT-123: Could not find artifact org.jfrog.test:multi:pom:${revision}-${sha1} in central (http://localhost:8081/artifactory/san-libs-release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Expected behavior
Maven should resolve the dependency artifacts successfully as the given version is existing in the repository.
Screenshots
Attached
Versions
Artifactory Maven plugin version: 3.2.1
Artifactory version: 7.15.2
Maven version: apache-maven-3.6.3
Additional context
Pom files in the target folders are created with actual values (i.e, 2.0.0-SNAPSHOT-123). Please find the below pom file snippet of the version which got created in the target folder for the multi1 project.
However, the pom file from the source folder with predefined value got deployed to the Artifactory (Please refer to the attached screenshot) instead of the pom file from the target folder.
The text was updated successfully, but these errors were encountered:
@sandeepani2206
Thanks for reporting this issue.
Supporting the unique-revision-maven-filtering extension is not a bug, but a feature request.
In the Maven Artifactory plugin we override the deploy goal. Ultimately, all artifacts are uploaded to Artifactory using our ModuleParallelDeploy. We use this method for many reasons. Some of them are:
Collecting the build-info
Avoiding writing temp files in the file system
Checksum deployment
Parallel deployment
Producer-consumer design pattern
Exclude artifacts from uploading
More...
I looked at the unique-revision-maven-filtering and it looks like it overrides the MetadataGeneratorFactory which we don't use in the Artifactory Maven plugin.
However, it does generate the required pom under /target directory. Therefore I believe we can support this feature in the future.
Describe the bug
Maven install/deploy fails when we publish POM files with the predefined variables like {revision} instead of actual values to the Artifactory using the Artifactory Maven plugin.
To Reproduce
Clone a sample multi module project and update the artifacts to predefined variables (like {revision} and {sha1}) instead of actual value in the pom.xml file as shown here.
Added the extension(https://github.com/jcgay/unique-revision-maven-filtering) which replaces the ${revision} and {sha1} version in POM to actual value to the pom.xml file in target folder when installing / deploying the artifacts.
Deploy the project to the Artifactory.
Sample command used : mvn clean deploy -Drevision=2.0.0-SNAPSHOT -Dsha1=123 -Dbuildnumber=1
Parent pom.xml
<artifactId>multi</artifactId>
<version>${revision}-${sha1}</version>
<packaging>pom</packaging>
Child pom.xml:
<parent>
<groupId>org.jfrog.test</groupId>
<artifactId>multi</artifactId>
<version>${revision}-${sha1}</version>
</parent>
<artifactId>multi1</artifactId>
<packaging>jar</packaging>
<name>Multi 1</name>
As shown below:
<dependency>
<groupId>org.jfrog.test</groupId>
<artifactId>multi1</artifactId>
<version>${revision}-${sha1}</version>
</dependency>
Sample command used : mvn clean install -Drevision=2.0.0-SNAPSHOT -Dbuildnumber=1 -Dsha1=123
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.650 s
[INFO] Finished at: 2021-04-17T20:40:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project maven-example: Could not resolve dependencies for project org.jfrog.example:maven-example:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.jfrog.test:multi1:jar:2.0.0-SNAPSHOT-123: Failed to read artifact descriptor for org.jfrog.test:multi1:jar:2.0.0-SNAPSHOT-123: Could not find artifact org.jfrog.test:multi:pom:${revision}-${sha1} in central (http://localhost:8081/artifactory/san-libs-release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Expected behavior
Maven should resolve the dependency artifacts successfully as the given version is existing in the repository.
Screenshots
Attached
Versions
Additional context
Pom files in the target folders are created with actual values (i.e, 2.0.0-SNAPSHOT-123). Please find the below pom file snippet of the version which got created in the target folder for the multi1 project.
<parent>
<groupId>org.jfrog.test</groupId>
<artifactId>multi</artifactId>
<version>2.0.0-SNAPSHOT-123</version>
</parent>
However, the pom file from the source folder with predefined value got deployed to the Artifactory (Please refer to the attached screenshot) instead of the pom file from the target folder.
![pomfile_sample](https://user-images.githubusercontent.com/66374485/117569903-80cf4a00-b0e5-11eb-9a5f-717bfbd3d192.png)
The text was updated successfully, but these errors were encountered: