-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#224 support standard Gradle dependency notation in "importPom" #229
base: main
Are you sure you want to change the base?
Conversation
… in "importPom"
@bsideup Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@bsideup Thank you for signing the Contributor License Agreement! |
PomReference reference = referencesById.get(createKey(id.getGroup(), id.getName())); | ||
CompositePropertySource allProperties = new CompositePropertySource(reference.getProperties(), properties); | ||
resolvedPoms.add(createPom(resolvedArtifact.getFile(), allProperties)); | ||
for (PomReference pomReference: pomReferences) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change it to "1 configuration per POM", otherwise it is not possible to get the properties by resolved file.
Should be ok since there are usually only a few BOMs
String[] components = coordinates.split(":"); | ||
if (components.length != 3) { | ||
throw new IllegalArgumentException("Bom coordinates must be of the form groupId:artifactId:version"); | ||
if (dependencyNotation instanceof String || dependencyNotation instanceof GString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we have to handle Strings for the backward compatibility. We could also parse strings and add @pom
if not defined already, but that might cause unexpected issues for the users
@@ -28,29 +28,29 @@ | |||
public interface ImportsHandler { | |||
|
|||
/** | |||
* Imports the Maven bom with the given {@code coordinates} in the form {@code group:name:version}. | |||
* Imports the Maven bom with the given {@code dependencyNotation}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you describe what is dependencyNotation
with example or link to corresponding documentation section please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean something like "Dependency notations" from here?
https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/dsl/DependencyHandler.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thats it - will be enough to just link it
This solves #224 and also makes it possible to import POMs from any valid Gradle dependency notation (
group: "", artifact: "", version: ""
,project.files()
,fromURL
, etc)