mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-02-18 06:33:43 +08:00
fix(java): correctly inherit properties from parent fields for pom.xml files (#9111)
This commit is contained in:
@@ -2,20 +2,29 @@
|
||||
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>
|
||||
|
||||
<parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>top-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath>../top-parent</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>4.0.3</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<name>parent</name>
|
||||
<description>Parent</description>
|
||||
|
||||
<properties>
|
||||
<bom.version>3.0.0</bom.version>
|
||||
<dep.version>1.2.3</dep.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>example-bom</artifactId>
|
||||
<version>${bom.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -5,24 +5,32 @@
|
||||
<artifactId>child</artifactId>
|
||||
|
||||
<name>child</name>
|
||||
<version>1.2.3</version>
|
||||
<description>Child</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath>../parent</relativePath>
|
||||
<version>4.0.3</version>
|
||||
<relativePath>./parent</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<bom.version>4.0.0</bom.version>
|
||||
<project.parent.version>1.1.1</project.parent.version>
|
||||
<project.version>2.3.4</project.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>example-dependency</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>example-api3</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,29 +0,0 @@
|
||||
<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>top-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<name>top-parent</name>
|
||||
<description>Parent</description>
|
||||
|
||||
<properties>
|
||||
<bom.version>3.0.0</bom.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>example-bom</artifactId>
|
||||
<version>${bom.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user