-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(java): add support of test
scope for pom.xml
files
#7486
base: main
Are you sure you want to change the base?
Changes from 2 commits
eaf6b88
09fd4b4
51c9d37
6deda97
11cdd3e
76f4342
d1abac5
4b29756
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,7 +303,7 @@ func (d pomDependency) ToArtifact(opts analysisOptions) artifact { | |
Exclusions: exclusions, | ||
Locations: locations, | ||
Relationship: ftypes.RelationshipIndirect, // default | ||
Test: d.Scope == "test", | ||
Test: d.Scope == "test" || opts.testScope, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't it mean it'll include the test even if testScope is false? Unlike the other PR, this PR still includes test dependencies for me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm... that's weird.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It takes ages to scan and then fails with:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is timeout error. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.example</groupId> | ||
<artifactId>test-example</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<name>test-example</name> | ||
<description>Example</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.example</groupId> | ||
<artifactId>example-dependency</artifactId> | ||
<version>1.2.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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'm wondering if it works as expected. For example, if two direct dependencies have the same transitive dependency, and one scope is "test" and the other is not, I guess it would not be considered devDependency. How does Maven work?
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.
hm... Nice catch.
I updated logic and added test for this case (comment before test shows how
mvn
works).Can you take a look and check that this is what you meant?