[GRADLE-2238] Use maven 3 classes to locate maven local repository Created: 16/Apr/12  Updated: 04/Jan/13  Resolved: 17/Jul/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-rc-1
Fix Version/s: 1.1-rc-1

Type: Bug
Reporter: gil Assignee: Unassigned
Resolution: Fixed Votes: 0

Attachments: XML File gradle-1.0-rc-1-00-build.xml    


As part of the effort to include Java software in Fedora (http://fedoraproject.org) we are in the process of building and packaging Gradle. One of the issues we have is that Fedora has a very strict requirement: any software in Fedora should be buildable with software already existing in Fedora. In order to meet this requirement we are preparing using an ant build script to build a first version of Gradle that we can then to auto-build Gradle.

see http://issues.gradle.org/browse/GRADLE-2210

One of the issues we find with this approach is the following error:

Caused by: org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException: java.lang.NoSuchFieldException: userSettingsFile
at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.buildSettings(DefaultLocalMavenRepositoryLocator.java:75)

Apparently the reason for this error is that the version of the DefaultLocalMavenRepositoryLauncher in maven 3 doesn't have the "userSettingsFile" field. Any suggestion on how to fix this? Do you have any plans to migrate to maven 3?

Comment by René Gröschke (Inactive) [ 10/Jul/12 ]

We just changed the implementation of the DefaultLocalMavenRepositoryLocator to use the maven 3 SettingsBuilder. Since we use maven2 libraries at other places in gradle we used jarjar (https://code.google.com/p/jarjar/) to repackage the settingsbuilder artifacts ("org.apache.maven:maven-settings-builder:3.0.4"). JarJar is shipped with an ant task and should be easy to integrate in your gradle ant build. The pattern we use for repackaging is:

rule: pattern:'org.apache.maven.**', result:'org.apache.maven.jarjar.@1'
keep: pattern:'org.apache.maven.settings.building.SettingsBuildingResult'
keep: pattern:'org.apache.maven.settings.building.SettingsBuildingRequest'
keep: pattern:'org.apache.maven.settings.building.SettingsBuildingException'
keep: pattern:'org.apache.maven.settings.building.DefaultSettingsBuildingRequest'
keep: pattern:'org.apache.maven.settings.building.DefaultSettingsBuilderFactory'
keep: pattern:'org.apache.maven.settings.building.DefaultSettingsBuilder'
Comment by gil [ 11/Jul/12 ]

but this pattern isn't applicable in fedora

Comment by Carlo de Wolf [ 12/Aug/12 ]

The only workable solution for Fedora would be to have an SPI in Gradle with a Maven 3 implementation backing it. You can also do a Maven 2 implementation and let a it be pluggable with a jar service provider.


Thus the Maven 3 implementation will have a true Maven 3 dependency, while the Maven 2 implementation will have a Maven 2 dependency. (So Fedora will not ship the Maven 2 implementation.)

Generated at Wed Jun 30 12:16:28 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.