mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
parent
e52aa3bc03
commit
fb388c0f25
@ -4,6 +4,8 @@ import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/vifraa/gopom"
|
||||
@ -16,6 +18,8 @@ import (
|
||||
const pomXMLGlob = "*pom.xml"
|
||||
const pomXMLDirGlob = "**/pom.xml"
|
||||
|
||||
var propertyMatcher = regexp.MustCompile("[$][{][^}]+[}]")
|
||||
|
||||
func parserPomXML(path string, content io.Reader) ([]*pkg.Package, []artifact.Relationship, error) {
|
||||
pom, err := decodePomXML(content)
|
||||
if err != nil {
|
||||
@ -24,7 +28,7 @@ func parserPomXML(path string, content io.Reader) ([]*pkg.Package, []artifact.Re
|
||||
|
||||
var pkgs []*pkg.Package
|
||||
for _, dep := range pom.Dependencies {
|
||||
p := newPackageFromPom(dep)
|
||||
p := newPackageFromPom(pom, dep)
|
||||
if p.Name == "" {
|
||||
continue
|
||||
}
|
||||
@ -46,27 +50,27 @@ func parsePomXMLProject(path string, reader io.Reader) (*pkg.PomProject, error)
|
||||
func newPomProject(path string, p gopom.Project) *pkg.PomProject {
|
||||
return &pkg.PomProject{
|
||||
Path: path,
|
||||
Parent: pomParent(p.Parent),
|
||||
GroupID: p.GroupID,
|
||||
Parent: pomParent(p, p.Parent),
|
||||
GroupID: resolveProperty(p, p.GroupID),
|
||||
ArtifactID: p.ArtifactID,
|
||||
Version: p.Version,
|
||||
Version: resolveProperty(p, p.Version),
|
||||
Name: p.Name,
|
||||
Description: cleanDescription(p.Description),
|
||||
URL: p.URL,
|
||||
}
|
||||
}
|
||||
|
||||
func newPackageFromPom(dep gopom.Dependency) *pkg.Package {
|
||||
func newPackageFromPom(pom gopom.Project, dep gopom.Dependency) *pkg.Package {
|
||||
p := &pkg.Package{
|
||||
Name: dep.ArtifactID,
|
||||
Version: dep.Version,
|
||||
Version: resolveProperty(pom, dep.Version),
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg, // TODO: should we differentiate between packages from jar/war/zip versus packages from a pom.xml that were not installed yet?
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
FoundBy: javaPomCataloger,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PomProperties: &pkg.PomProperties{
|
||||
GroupID: dep.GroupID,
|
||||
GroupID: resolveProperty(pom, dep.GroupID),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -87,12 +91,12 @@ func decodePomXML(content io.Reader) (project gopom.Project, err error) {
|
||||
return project, nil
|
||||
}
|
||||
|
||||
func pomParent(parent gopom.Parent) (result *pkg.PomParent) {
|
||||
func pomParent(pom gopom.Project, parent gopom.Parent) (result *pkg.PomParent) {
|
||||
if parent.ArtifactID != "" || parent.GroupID != "" || parent.Version != "" {
|
||||
result = &pkg.PomParent{
|
||||
GroupID: parent.GroupID,
|
||||
GroupID: resolveProperty(pom, parent.GroupID),
|
||||
ArtifactID: parent.ArtifactID,
|
||||
Version: parent.Version,
|
||||
Version: resolveProperty(pom, parent.Version),
|
||||
}
|
||||
}
|
||||
return result
|
||||
@ -109,3 +113,42 @@ func cleanDescription(original string) (cleaned string) {
|
||||
}
|
||||
return strings.TrimSpace(cleaned)
|
||||
}
|
||||
|
||||
// resolveProperty emulates some maven property resolution logic by looking in the project's variables
|
||||
// as well as supporting the project expressions like ${project.parent.groupId}.
|
||||
// If no match is found, the entire expression including ${} is returned
|
||||
func resolveProperty(pom gopom.Project, property string) string {
|
||||
return propertyMatcher.ReplaceAllStringFunc(property, func(match string) string {
|
||||
propertyName := strings.TrimSpace(match[2 : len(match)-1])
|
||||
if value, ok := pom.Properties.Entries[propertyName]; ok {
|
||||
return value
|
||||
}
|
||||
// if we don't find anything directly in the pom properties,
|
||||
// see if we have a project.x expression and process this based
|
||||
// on the xml tags in gopom
|
||||
parts := strings.Split(propertyName, ".")
|
||||
numParts := len(parts)
|
||||
if numParts > 1 && strings.TrimSpace(parts[0]) == "project" {
|
||||
pomValue := reflect.ValueOf(pom)
|
||||
pomValueType := pomValue.Type()
|
||||
for partNum := 1; partNum < numParts; partNum++ {
|
||||
if pomValueType.Kind() != reflect.Struct {
|
||||
break
|
||||
}
|
||||
part := parts[partNum]
|
||||
for fieldNum := 0; fieldNum < pomValueType.NumField(); fieldNum++ {
|
||||
f := pomValueType.Field(fieldNum)
|
||||
if part == f.Tag.Get("xml") {
|
||||
pomValue = pomValue.Field(fieldNum)
|
||||
pomValueType = pomValue.Type()
|
||||
if partNum == numParts-1 {
|
||||
return fmt.Sprintf("%v", pomValue.Interface())
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return match
|
||||
})
|
||||
}
|
||||
|
||||
@ -57,6 +57,141 @@ func Test_parserPomXML(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_parseCommonsTextPomXMLProject(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expected []*pkg.Package
|
||||
}{
|
||||
{
|
||||
input: "test-fixtures/pom/commons-text.pom.xml",
|
||||
expected: []*pkg.Package{
|
||||
{
|
||||
Name: "commons-lang3",
|
||||
Version: "3.12.0",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.apache.commons/commons-lang3@3.12.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "junit-jupiter",
|
||||
Version: "",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.junit.jupiter/junit-jupiter",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "assertj-core",
|
||||
Version: "3.23.1",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.assertj/assertj-core@3.23.1",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "commons-io",
|
||||
Version: "2.11.0",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/commons-io/commons-io@2.11.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "mockito-inline",
|
||||
Version: "4.8.0",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.mockito/mockito-inline@4.8.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "js",
|
||||
Version: "22.0.0.2",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.graalvm.js/js@22.0.0.2",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "js-scriptengine",
|
||||
Version: "22.0.0.2",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.graalvm.js/js-scriptengine@22.0.0.2",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "commons-rng-simple",
|
||||
Version: "1.4",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.apache.commons/commons-rng-simple@1.4",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "jmh-core",
|
||||
Version: "1.35",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.openjdk.jmh/jmh-core@1.35",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "jmh-generator-annprocess",
|
||||
Version: "1.35",
|
||||
FoundBy: javaPomCataloger,
|
||||
Language: pkg.Java,
|
||||
Type: pkg.JavaPkg,
|
||||
MetadataType: pkg.JavaMetadataType,
|
||||
Metadata: pkg.JavaMetadata{
|
||||
PURL: "pkg:maven/org.openjdk.jmh/jmh-generator-annprocess@1.35",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.input, func(t *testing.T) {
|
||||
fixture, err := os.Open(test.input)
|
||||
assert.NoError(t, err)
|
||||
|
||||
actual, relationships, err := parserPomXML(fixture.Name(), fixture)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, relationships)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_parsePomXMLProject(t *testing.T) {
|
||||
tests := []struct {
|
||||
expected pkg.PomProject
|
||||
@ -141,7 +276,7 @@ func Test_pomParent(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
assert.Equal(t, test.expected, pomParent(test.input))
|
||||
assert.Equal(t, test.expected, pomParent(gopom.Project{}, test.input))
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -168,3 +303,50 @@ func Test_cleanDescription(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_resolveProperty(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
property string
|
||||
pom gopom.Project
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "property",
|
||||
property: "${version.number}",
|
||||
pom: gopom.Project{
|
||||
Properties: gopom.Properties{
|
||||
Entries: map[string]string{
|
||||
"version.number": "12.5.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: "12.5.0",
|
||||
},
|
||||
{
|
||||
name: "groupId",
|
||||
property: "${project.groupId}",
|
||||
pom: gopom.Project{
|
||||
GroupID: "org.some.group",
|
||||
},
|
||||
expected: "org.some.group",
|
||||
},
|
||||
{
|
||||
name: "parent groupId",
|
||||
property: "${project.parent.groupId}",
|
||||
pom: gopom.Project{
|
||||
Parent: gopom.Parent{
|
||||
GroupID: "org.some.parent",
|
||||
},
|
||||
},
|
||||
expected: "org.some.parent",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
resolved := resolveProperty(test.pom, test.property)
|
||||
assert.Equal(t, test.expected, resolved)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
575
syft/pkg/cataloger/java/test-fixtures/pom/commons-text.pom.xml
Normal file
575
syft/pkg/cataloger/java/test-fixtures/pom/commons-text.pom.xml
Normal file
@ -0,0 +1,575 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>54</version>
|
||||
</parent>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<name>Apache Commons Text</name>
|
||||
<description>Apache Commons Text is a library focused on algorithms working on strings.</description>
|
||||
<url>https://commons.apache.org/proper/commons-text</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
||||
<commons.componentid>text</commons.componentid>
|
||||
<commons.module.name>org.apache.commons.text</commons.module.name>
|
||||
|
||||
<commons.release.version>1.10.0</commons.release.version>
|
||||
<commons.release.desc>(Java 8+)</commons.release.desc>
|
||||
|
||||
<commons.jira.id>TEXT</commons.jira.id>
|
||||
<commons.jira.pid>12318221</commons.jira.pid>
|
||||
|
||||
<commons.site.path>text</commons.site.path>
|
||||
<commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-text</commons.scmPubUrl>
|
||||
<commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory>
|
||||
|
||||
<commons.junit.version>5.9.1</commons.junit.version>
|
||||
<checkstyle.plugin.version>3.2.0</checkstyle.plugin.version>
|
||||
<checkstyle.version>9.3</checkstyle.version>
|
||||
|
||||
<commons.spotbugs.plugin.version>4.7.2.0</commons.spotbugs.plugin.version>
|
||||
<commons.spotbugs.impl.version>4.7.2</commons.spotbugs.impl.version>
|
||||
<commons.pmd.version>3.19.0</commons.pmd.version>
|
||||
<commons.pmd-impl.version>6.49.0</commons.pmd-impl.version>
|
||||
|
||||
<commons.mockito.version>4.8.0</commons.mockito.version>
|
||||
<commons.jacoco.version>0.8.8</commons.jacoco.version>
|
||||
|
||||
<!-- apache-rat-plugin 0.13 and jdepend-maven-plugin 2.0 both fail with LinkageError when generating reports
|
||||
with maven site plugin 3.11+. However, javadoc 3.4.0+ fails with site plugin versions lower than 3.11. So, we'll
|
||||
use slightly older site and javadoc versions here in order to be able to generate all reports. -->
|
||||
<commons.site-plugin.version>3.10.0</commons.site-plugin.version>
|
||||
<commons.javadoc.version>3.4.1</commons.javadoc.version>
|
||||
|
||||
<!-- 22.1.0 requires Java 11 -->
|
||||
<graalvm.version>22.0.0.2</graalvm.version>
|
||||
<commons.rng.version>1.4</commons.rng.version>
|
||||
|
||||
<commons.japicmp.version>0.16.0</commons.japicmp.version>
|
||||
<japicmp.skip>false</japicmp.skip>
|
||||
|
||||
<jmh.version>1.35</jmh.version>
|
||||
<commons.project-info.version>3.1.2</commons.project-info.version>
|
||||
|
||||
<!-- Commons Release Plugin -->
|
||||
<commons.bc.version>1.9</commons.bc.version>
|
||||
<commons.rc.version>RC1</commons.rc.version>
|
||||
<commons.release.isDistModule>true</commons.release.isDistModule>
|
||||
<commons.distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid}</commons.distSvnStagingUrl>
|
||||
<commons.releaseManagerName>Gary Gregory</commons.releaseManagerName>
|
||||
<commons.releaseManagerKey>86fdc7e2a11262cb</commons.releaseManagerKey>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<!-- testing -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.23.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<!-- Use mockito-inline instead of mockito-core to mock and spy on final classes. -->
|
||||
<artifactId>mockito-inline</artifactId>
|
||||
<version>${commons.mockito.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.graalvm.js</groupId>
|
||||
<artifactId>js</artifactId>
|
||||
<version>${graalvm.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.graalvm.js</groupId>
|
||||
<artifactId>js-scriptengine</artifactId>
|
||||
<version>${graalvm.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-rng-simple</artifactId>
|
||||
<version>${commons.rng.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-core</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-generator-annprocess</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean verify apache-rat:check japicmp:cmp checkstyle:check spotbugs:check javadoc:javadoc</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
<artifactId>apache-rat-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>site-content/**</exclude>
|
||||
<exclude>src/site/resources/download_lang.cgi</exclude>
|
||||
<exclude>src/test/resources/org/apache/commons/text/stringEscapeUtilsTestData.txt</exclude>
|
||||
<exclude>src/test/resources/org/apache/commons/text/lcs-perf-analysis-inputs.csv</exclude>
|
||||
<exclude>src/site/resources/release-notes/RELEASE-NOTES-*.txt</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin><!-- override skip property of parent pom -->
|
||||
<plugin>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>${commons.pmd.version}</version>
|
||||
<configuration>
|
||||
<targetJdk>${maven.compiler.target}</targetJdk>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-core</artifactId>
|
||||
<version>${commons.pmd-impl.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-java</artifactId>
|
||||
<version>${commons.pmd-impl.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-javascript</artifactId>
|
||||
<version>${commons.pmd-impl.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.pmd</groupId>
|
||||
<artifactId>pmd-jsp</artifactId>
|
||||
<version>${commons.pmd-impl.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${checkstyle.plugin.version}</version>
|
||||
<configuration>
|
||||
<enableRulesSummary>false</enableRulesSummary>
|
||||
<configLocation>src/conf/checkstyle.xml</configLocation>
|
||||
<headerLocation>src/conf/checkstyle-header.txt</headerLocation>
|
||||
<suppressionsLocation>src/conf/checkstyle-suppressions.xml</suppressionsLocation>
|
||||
<suppressionsFileExpression>src/conf/checkstyle-suppressions.xml</suppressionsFileExpression>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
<excludes>**/generated/**.java,**/jmh_generated/**.java</excludes>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>${checkstyle.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>${commons.spotbugs.plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs</artifactId>
|
||||
<version>${commons.spotbugs.impl.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<excludeFilterFile>src/conf/spotbugs-exclude-filter.xml</excludeFilterFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/assembly/bin.xml</descriptor>
|
||||
<descriptor>src/assembly/src.xml</descriptor>
|
||||
</descriptors>
|
||||
<tarLongFileMode>gnu</tarLongFileMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive combine.children="append">
|
||||
<manifestEntries>
|
||||
<Automatic-Module-Name>${commons.module.name}</Automatic-Module-Name>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-publish-plugin</artifactId>
|
||||
<configuration>
|
||||
<ignorePathsToDelete>
|
||||
<ignorePathToDelete>javadocs</ignorePathToDelete>
|
||||
</ignorePathsToDelete>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${checkstyle.plugin.version}</version>
|
||||
<configuration>
|
||||
<enableRulesSummary>false</enableRulesSummary>
|
||||
<configLocation>src/conf/checkstyle.xml</configLocation>
|
||||
<headerLocation>src/conf/checkstyle-header.txt</headerLocation>
|
||||
<suppressionsLocation>src/conf/checkstyle-suppressions.xml</suppressionsLocation>
|
||||
<suppressionsFileExpression>src/conf/checkstyle-suppressions.xml</suppressionsFileExpression>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
<excludes>**/generated/**.java,**/jmh_generated/**.java</excludes>
|
||||
</configuration>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>checkstyle</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
<!-- Requires setting 'export MAVEN_OPTS="-Xmx512m" ' -->
|
||||
<plugin>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-maven-plugin</artifactId>
|
||||
<version>${commons.spotbugs.plugin.version}</version>
|
||||
<configuration>
|
||||
<excludeFilterFile>src/conf/spotbugs-exclude-filter.xml</excludeFilterFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.siom79.japicmp</groupId>
|
||||
<artifactId>japicmp-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>3.19.0</version>
|
||||
<configuration>
|
||||
<targetJdk>${maven.compiler.target}</targetJdk>
|
||||
</configuration>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>pmd</report>
|
||||
<report>cpd</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>taglist-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<tagListOptions>
|
||||
<tagClasses>
|
||||
<tagClass>
|
||||
<displayName>Needs Work</displayName>
|
||||
<tags>
|
||||
<tag>
|
||||
<matchString>TODO</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
<tag>
|
||||
<matchString>FIXME</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
<tag>
|
||||
<matchString>XXX</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
</tags>
|
||||
</tagClass>
|
||||
<tagClass>
|
||||
<displayName>Noteable Markers</displayName>
|
||||
<tags>
|
||||
<tag>
|
||||
<matchString>NOTE</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
<tag>
|
||||
<matchString>NOPMD</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
<tag>
|
||||
<matchString>NOSONAR</matchString>
|
||||
<matchType>exact</matchType>
|
||||
</tag>
|
||||
</tags>
|
||||
</tagClass>
|
||||
</tagClasses>
|
||||
</tagListOptions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<inceptionYear>2014</inceptionYear>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>kinow</id>
|
||||
<name>Bruno P. Kinoshita</name>
|
||||
<email>kinow@apache.org</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>britter</id>
|
||||
<name>Benedikt Ritter</name>
|
||||
<email>britter@apache.org</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>chtompki</id>
|
||||
<name>Rob Tompkins</name>
|
||||
<email>chtompki@apache.org</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>ggregory</id>
|
||||
<name>Gary Gregory</name>
|
||||
<email>ggregory at apache.org</email>
|
||||
<url>https://www.garygregory.com</url>
|
||||
<organization>The Apache Software Foundation</organization>
|
||||
<organizationUrl>https://www.apache.org/</organizationUrl>
|
||||
<roles>
|
||||
<role>PMC Member</role>
|
||||
</roles>
|
||||
<timezone>America/New_York</timezone>
|
||||
<properties>
|
||||
<picUrl>https://people.apache.org/~ggregory/img/garydgregory80.png</picUrl>
|
||||
</properties>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>djones</id>
|
||||
<name>Duncan Jones</name>
|
||||
<email>djones@apache.org</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<contributors>
|
||||
<contributor>
|
||||
<name>Don Jeba</name>
|
||||
<email>donjeba@yahoo.com</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Sampanna Kahu</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jarek Strzelecki</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Lee Adcock</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Amey Jadiye</name>
|
||||
<email>ameyjadiye@gmail.com</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Arun Vinud S S</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Ioannis Sermetziadis</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jostein Tveit</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Luciano Medallia</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jan Martin Keil</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Nandor Kollar</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Nick Wong</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Ali Ghanbari</name>
|
||||
<url>https://ali-ghanbari.github.io/</url>
|
||||
</contributor>
|
||||
</contributors>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://gitbox.apache.org/repos/asf/commons-text</connection>
|
||||
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-text</developerConnection>
|
||||
<url>https://gitbox.apache.org/repos/asf?p=commons-text.git</url>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
<system>jira</system>
|
||||
<url>https://issues.apache.org/jira/browse/TEXT</url>
|
||||
</issueManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>apache.website</id>
|
||||
<name>Apache Commons Site</name>
|
||||
<url>scm:svn:https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-text/</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>setup-checkout</id>
|
||||
<activation>
|
||||
<file>
|
||||
<missing>site-content</missing>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>prepare-checkout</id>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<phase>pre-site</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<exec executable="svn">
|
||||
<arg line="checkout --depth immediates ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}"/>
|
||||
</exec>
|
||||
<exec executable="svn">
|
||||
<arg line="update --set-depth exclude ${commons.scmPubCheckoutDirectory}/javadocs"/>
|
||||
</exec>
|
||||
<pathconvert pathsep=" " property="dirs">
|
||||
<dirset dir="${commons.scmPubCheckoutDirectory}" includes="*"/>
|
||||
</pathconvert>
|
||||
<exec executable="svn">
|
||||
<arg line="update --set-depth infinity ${dirs}"/>
|
||||
</exec>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>java9+</id>
|
||||
<activation>
|
||||
<jdk>[9,)</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<!-- coverall version 4.3.0 does not work with java 9+, see https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
|
||||
<coveralls.skip>true</coveralls.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>benchmark</id>
|
||||
<properties>
|
||||
<skipTests>true</skipTests>
|
||||
<benchmark>org.apache</benchmark>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>benchmark</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classpathScope>test</classpathScope>
|
||||
<executable>java</executable>
|
||||
<arguments>
|
||||
<argument>-classpath</argument>
|
||||
<classpath/>
|
||||
<argument>org.openjdk.jmh.Main</argument>
|
||||
<argument>-rf</argument>
|
||||
<argument>json</argument>
|
||||
<argument>-rff</argument>
|
||||
<argument>target/jmh-result.${benchmark}.json</argument>
|
||||
<argument>${benchmark}</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
Loading…
x
Reference in New Issue
Block a user