-
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 for maven-metadata.xml
files for remote snapshot repositories.
#6950
Merged
knqyf263
merged 4 commits into
aquasecurity:main
from
DmitriyLewen:feat-pom/maven-metadata-xml-for-snapshots
Jun 19, 2024
+231
−5
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pom | ||
|
||
type Metadata struct { | ||
GroupId string `xml:"groupId"` | ||
ArtifactId string `xml:"artifactId"` | ||
Versioning Versioning `xml:"versioning"` | ||
Version string `xml:"version"` | ||
} | ||
|
||
type Versioning struct { | ||
SnapshotVersions []SnapshotVersion `xml:"snapshotVersions>snapshotVersion"` | ||
} | ||
|
||
type SnapshotVersion struct { | ||
Extension string `xml:"extension"` | ||
Value string `xml:"value"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
...ample/example-dependency/2.17.0-SNAPSHOT/example-dependency-2.17.0-20240312.035235-10.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>org.example</groupId> | ||
<artifactId>example-dependency</artifactId> | ||
<version>2.17.0-SNAPSHOT</version> | ||
|
||
<packaging>jar</packaging> | ||
<name>Example API Dependency</name> | ||
<description>The example API</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.example</groupId> | ||
<artifactId>example-api</artifactId> | ||
<version>2.0.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
35 changes: 35 additions & 0 deletions
35
...pom/testdata/repository/org/example/example-dependency/2.17.0-SNAPSHOT/maven-metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<metadata modelVersion="1.1.0"> | ||
<groupId>org.example</groupId> | ||
<artifactId>example-dependency</artifactId> | ||
<versioning> | ||
<lastUpdated>20240312035235</lastUpdated> | ||
<snapshot> | ||
<timestamp>20240312.035235</timestamp> | ||
<buildNumber>10</buildNumber> | ||
</snapshot> | ||
<snapshotVersions> | ||
<snapshotVersion> | ||
<classifier>sources</classifier> | ||
<extension>jar</extension> | ||
<value>2.17.0-20240312.035235-10</value> | ||
<updated>20240312035235</updated> | ||
</snapshotVersion> | ||
<snapshotVersion> | ||
<extension>module</extension> | ||
<value>2.17.0-20240312.035235-10</value> | ||
<updated>20240312035235</updated> | ||
</snapshotVersion> | ||
<snapshotVersion> | ||
<extension>jar</extension> | ||
<value>2.17.0-20240312.035235-10</value> | ||
<updated>20240312035235</updated> | ||
</snapshotVersion> | ||
<snapshotVersion> | ||
<extension>pom</extension> | ||
<value>2.17.0-20240312.035235-10</value> | ||
<updated>20240312035235</updated> | ||
</snapshotVersion> | ||
</snapshotVersions> | ||
</versioning> | ||
<version>2.17.0-SNAPSHOT</version> | ||
</metadata> |
20 changes: 20 additions & 0 deletions
20
pkg/dependency/parser/java/pom/testdata/snapshot/with-maven-metadata/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>happy</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<name>happy</name> | ||
<description>Example</description> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.example</groupId> | ||
<artifactId>example-dependency</artifactId> | ||
<version>2.17.0-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wanted to point out we should use
slices
and started adding a new linter. Then, I forgot to leave a comment😆Fixed in 2e5cc1f