Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bsideup
Copy link

@bsideup bsideup commented Sep 27, 2018

This solves #224 and also makes it possible to import POMs from any valid Gradle dependency notation (group: "", artifact: "", version: "", project.files(), fromURL, etc)

@pivotal-issuemaster
Copy link

@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.

@pivotal-issuemaster
Copy link

@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) {
Copy link
Author

@bsideup bsideup Sep 27, 2018

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) {
Copy link
Author

@bsideup bsideup Sep 27, 2018

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}.
Copy link

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants