Skip to content

Commit a001800

Browse files
Merge pull request #3427 from nexB/fix-maven-pom-resource-assign
Fix maven pom resource assignment
2 parents b52f7df + ff81f96 commit a001800

File tree

17 files changed

+1970
-1
lines changed

17 files changed

+1970
-1
lines changed

src/packagedcode/maven.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,21 @@ def assign_package_to_resources(cls, package, resource, codebase, package_adder)
132132
if resource.path.endswith(f'META-INF/maven/{package.namespace}/{package.name}/pom.xml'):
133133
# First case: a pom.xml inside a META-INF directory such as in
134134
# /META-INF/maven/log4j/log4j/pom.xml: This requires going up 5 times
135-
upward_segments = 5
135+
upward_segments = 4
136136
root = resource
137137
for _ in range(upward_segments):
138138
root = root.parent(codebase)
139+
140+
number_poms = 0
141+
for child in root.walk(codebase):
142+
if 'pom.xml' in child.path:
143+
number_poms += 1
144+
145+
if number_poms > 1:
146+
root = resource
147+
else:
148+
root = root.parent(codebase)
149+
139150
else:
140151
# Second case: a pom.xml at the root of codebase tree
141152
# FIXME: handle the cases opf parent POMs and nested POMs

tests/packagedcode/data/maven_misc/uberjars/htrace-core-4.0.0-incubating-expected.json

Lines changed: 1483 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// ------------------------------------------------------------------
2+
// Transitive dependencies of this project determined from the
3+
// maven pom organized by organization.
4+
// ------------------------------------------------------------------
5+
6+
htrace-core
7+
8+
9+
From: 'FasterXML' (http://fasterxml.com/)
10+
- Jackson-annotations (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-annotations:bundle:2.4.0
11+
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
12+
- Jackson-core (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-core:bundle:2.4.0
13+
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
14+
- jackson-databind (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-databind:bundle:2.4.0
15+
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
16+
17+
From: 'The Apache Software Foundation' (http://www.apache.org/)
18+
- Commons Logging (http://commons.apache.org/logging) commons-logging:commons-logging:jar:1.1.1
19+
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
20+
21+
22+
23+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
Apache License
3+
Version 2.0, January 2004
4+
http://www.apache.org/licenses/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Manifest-Version: 1.0
2+
Implementation-Vendor: The Apache Software Foundation
3+
Implementation-Title: htrace-core
4+
Implementation-Version: 4.0.0-incubating
5+
Implementation-Vendor-Id: org.apache.htrace
6+
Built-By: cmccabe
7+
Build-Jdk: 1.7.0_10
8+
Specification-Vendor: The Apache Software Foundation
9+
Specification-Title: htrace-core
10+
Created-By: Apache Maven 3.0.4
11+
Specification-Version: 4.0.0-incubating
12+
Archiver-Version: Plexus Archiver
13+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
htrace-core
3+
Copyright 2015 The Apache Software Foundation
4+
5+
This product includes software developed at
6+
The Apache Software Foundation (http://www.apache.org/).
7+
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>com.fasterxml.jackson</groupId>
6+
<artifactId>jackson-parent</artifactId>
7+
<version>2.4</version>
8+
</parent>
9+
10+
<groupId>com.fasterxml.jackson.core</groupId>
11+
<artifactId>jackson-annotations</artifactId>
12+
<name>Jackson-annotations</name>
13+
<version>2.4.0</version>
14+
<packaging>bundle</packaging>
15+
<description>Core annotations used for value types, used by Jackson data binding package.
16+
</description>
17+
18+
<url>http://wiki.fasterxml.com/JacksonHome</url>
19+
<scm>
20+
<connection>scm:git:[email protected]:FasterXML/jackson-annotations.git</connection>
21+
<developerConnection>scm:git:[email protected]:FasterXML/jackson-annotations.git</developerConnection>
22+
<url>http://github.com/FasterXML/jackson-annotations</url>
23+
<tag>jackson-annotations-2.4.0</tag>
24+
</scm>
25+
26+
<properties>
27+
<osgi.export>com.fasterxml.jackson.annotation.*;version=${project.version}</osgi.export>
28+
</properties>
29+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>com.fasterxml.jackson</groupId>
5+
<artifactId>jackson-parent</artifactId>
6+
<version>2.4</version>
7+
</parent>
8+
9+
<groupId>com.fasterxml.jackson.core</groupId>
10+
<artifactId>jackson-core</artifactId>
11+
<name>Jackson-core</name>
12+
<version>2.4.0</version>
13+
<packaging>bundle</packaging>
14+
<description>Core Jackson abstractions, basic JSON streaming API implementation
15+
</description>
16+
17+
<url>http://wiki.fasterxml.com/JacksonHome</url>
18+
<scm>
19+
<connection>scm:git:[email protected]:FasterXML/jackson-core.git</connection>
20+
<developerConnection>scm:git:[email protected]:FasterXML/jackson-core.git</developerConnection>
21+
<url>http://github.com/FasterXML/jackson-core</url>
22+
<tag>jackson-core-2.4.0</tag>
23+
</scm>
24+
25+
<properties>
26+
<osgi.export>com.fasterxml.jackson.core;version=${project.version},
27+
com.fasterxml.jackson.core.*;version=${project.version}
28+
</osgi.export>
29+
30+
<!-- Generate PackageVersion.java into this directory. -->
31+
<packageVersion.dir>com/fasterxml/jackson/core/json</packageVersion.dir>
32+
<packageVersion.package>${project.groupId}.json</packageVersion.package>
33+
</properties>
34+
35+
<reporting>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-javadoc-plugin</artifactId>
40+
<version>2.8.1</version>
41+
<configuration>
42+
<aggregate>true</aggregate>
43+
<source>1.6</source>
44+
<encoding>UTF-8</encoding>
45+
<maxmemory>1g</maxmemory>
46+
<links>
47+
<!-- JDK, other Jackson pkgs -->
48+
<link>http://docs.oracle.com/javase/6/docs/api/</link>
49+
</links>
50+
<excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
51+
<bootclasspath>${sun.boot.class.path}</bootclasspath>
52+
<doclet>com.google.doclava.Doclava</doclet>
53+
<useStandardDocletOptions>false</useStandardDocletOptions>
54+
<additionalJOption>-J-Xmx1024m</additionalJOption>
55+
<docletArtifact>
56+
<groupId>com.google.doclava</groupId>
57+
<artifactId>doclava</artifactId>
58+
<version>1.0.3</version>
59+
</docletArtifact>
60+
<additionalparam>
61+
-hdf project.name "${project.name} ${project.version}"
62+
-d ${project.reporting.outputDirectory}/apidocs
63+
</additionalparam>
64+
</configuration>
65+
<reportSets>
66+
<reportSet>
67+
<id>default</id>
68+
<reports>
69+
<report>javadoc</report>
70+
</reports>
71+
</reportSet>
72+
</reportSets>
73+
</plugin>
74+
</plugins>
75+
</reporting>
76+
77+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>com.fasterxml.jackson</groupId>
7+
<artifactId>jackson-parent</artifactId>
8+
<version>2.4</version>
9+
</parent>
10+
11+
<groupId>com.fasterxml.jackson.core</groupId>
12+
<artifactId>jackson-databind</artifactId>
13+
<version>2.4.0</version>
14+
<name>jackson-databind</name>
15+
<packaging>bundle</packaging>
16+
<description>General data-binding functionality for Jackson: works on core streaming API</description>
17+
<url>http://wiki.fasterxml.com/JacksonHome</url>
18+
19+
<scm>
20+
<connection>scm:git:[email protected]:FasterXML/jackson-databind.git</connection>
21+
<developerConnection>scm:git:[email protected]:FasterXML/jackson-databind.git</developerConnection>
22+
<url>http://github.com/FasterXML/jackson-databind</url>
23+
<tag>jackson-databind-2.4.0</tag>
24+
</scm>
25+
26+
<dependencies>
27+
<!-- Builds on core streaming API; also needs core annotations -->
28+
<dependency>
29+
<groupId>com.fasterxml.jackson.core</groupId>
30+
<artifactId>jackson-annotations</artifactId>
31+
<version>2.4.0</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>com.fasterxml.jackson.core</groupId>
35+
<artifactId>jackson-core</artifactId>
36+
<version>2.4.0</version>
37+
</dependency>
38+
39+
<!-- and for testing we need a few libraries
40+
libs for which we use reflection for code, but direct dep for testing
41+
-->
42+
<dependency>
43+
<groupId>cglib</groupId>
44+
<artifactId>cglib</artifactId>
45+
<version>2.2.2</version>
46+
<scope>test</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.codehaus.groovy</groupId>
50+
<artifactId>groovy</artifactId>
51+
<version>1.7.9</version>
52+
<scope>test</scope>
53+
</dependency>
54+
<dependency> <!-- from core we just test for repackaged cglib, not hibernate proper -->
55+
<groupId>org.hibernate</groupId>
56+
<artifactId>hibernate-cglib-repack</artifactId>
57+
<version>2.1_3</version>
58+
<scope>test</scope>
59+
</dependency>
60+
</dependencies>
61+
62+
<reporting>
63+
<plugins>
64+
<plugin>
65+
<groupId>org.codehaus.mojo</groupId>
66+
<artifactId>cobertura-maven-plugin</artifactId>
67+
</plugin>
68+
</plugins>
69+
</reporting>
70+
71+
<profiles>
72+
<profile>
73+
<id>release</id>
74+
<properties>
75+
<maven.test.skip>true</maven.test.skip>
76+
<skipTests>true</skipTests>
77+
</properties>
78+
</profile>
79+
</profiles>
80+
81+
</project>

0 commit comments

Comments
 (0)