-
Notifications
You must be signed in to change notification settings - Fork 118
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
Include the classifier when creating an ArtifactKey from a org.apachemaven.artifact.Artifact #1358
Include the classifier when creating an ArtifactKey from a org.apachemaven.artifact.Artifact #1358
Conversation
@TheHound can you explain the specific problem this solves? Could it probably even be demonstrated as a junit test (e.g. in org.eclipse.m2e.core.tests? |
Sure I'll have a go tomorrow at adding a unit test but in the meantime a basic explanation of the issue is imagine the following dependencies : <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<classifier>tests<classifier>
<scope>test</scope>
</dependency> The dependency doesn't matter just the concept of having the same dependency but using different classifier with different scope. void setMavenProjectArtifacts(MavenProject mavenProject) {
Set<ArtifactRef> collect = mavenProject.getArtifacts().stream()
.map(a -> new ArtifactRef(new ArtifactKey(a), a.getScope()))
.collect(Collectors.toCollection(LinkedHashSet::new));
this.artifacts = Collections.unmodifiableSet(collect);
} https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java#L343 This can cause issues in other plugins using m2e (for example I am pretty sure the eclipse Jetty plugin doesn't handle maven projects using classifiers because of this) |
18996ba
to
7c88a5e
Compare
Have updated the commit with a test case demonstrating the expected change in artifact portable strings |
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.
Looks good to me but as its is a quite central change will request a review from some other commiters.
7c88a5e
to
da6a24b
Compare
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.
This looks like a reasonable change for me.
@mickaelistria what do you think?
da6a24b
to
0d59233
Compare
@mickaelistria, @akurtakov what do you think about this? |
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 don't see a reason against this change; unless test do show some related error.
It seems a versionbump is required, beside this I think it should be included in this release. FYI @fbricon |
0d59233
to
eef8eff
Compare
I think the classifier was not considered initially due to workspace project resolution. You need to ensure a workspace project A depending on workspace B and B:tests won't break for instance. |
The test passes in the CI. So should we still consider this or better have another solution? |
I haven't tested that change. If you're confident it's safe, then go ahead with it. |
Me neither and since I and nobody else considered the case you mentioned I'm not that confident. |
e3d9be1
to
425a520
Compare
….maven.artifact.Artifact to avoid issues with same dependency but different classifier & scope combinations
425a520
to
c7643f1
Compare
Let's see how this works IRL. |
Include the classifier when creating an ArtifactKey from a org.apachemaven.artifact.Artifact to avoid issues with same dependency but different classifier & scope combinations.