This is an automated email from the ASF dual-hosted git repository. pkarwasz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit e0c55ef6340dab2bec4a1edfcf243020c4743a54 Author: Piotr P. Karwasz <piotr.git...@karwasz.org> AuthorDate: Mon Sep 12 23:42:17 2022 +0200 Add missing test scopes Adds a test scope to all dependencies that inherit their scope from the parent POM. --- log4j-1.2-api/pom.xml | 1 + log4j-slf4j20-impl/pom.xml | 6 +++++- log4j-web/pom.xml | 4 +++- src/tools/sort-pom.xslt | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml index c3af148925..470a740576 100644 --- a/log4j-1.2-api/pom.xml +++ b/log4j-1.2-api/pom.xml @@ -49,6 +49,7 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> diff --git a/log4j-slf4j20-impl/pom.xml b/log4j-slf4j20-impl/pom.xml index 9135c65dd4..8b0d13a2d4 100644 --- a/log4j-slf4j20-impl/pom.xml +++ b/log4j-slf4j20-impl/pom.xml @@ -78,24 +78,28 @@ <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-to-slf4j</artifactId> - <scope>test</scope> <version>${project.version}</version> + <scope>test</scope> </dependency> <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-params</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> + <scope>test</scope> </dependency> </dependencies> <build> diff --git a/log4j-web/pom.xml b/log4j-web/pom.xml index 2798b8c1b1..601f48e961 100644 --- a/log4j-web/pom.xml +++ b/log4j-web/pom.xml @@ -67,6 +67,7 @@ <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> @@ -75,7 +76,8 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-junit-jupiter</artifactId> - </dependency> + <scope>test</scope> + </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> diff --git a/src/tools/sort-pom.xslt b/src/tools/sort-pom.xslt new file mode 100644 index 0000000000..bba9a340a0 --- /dev/null +++ b/src/tools/sort-pom.xslt @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:pom="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xalan="http://xml.apache.org/xslt" exclude-result-prefixes="pom xalan"> + <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="2" /> + <xsl:template match="pom:dependencies"> + <dependencies> + <xsl:apply-templates select="pom:dependency[pom:scope = 'import']"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + <xsl:apply-templates select="pom:dependency[pom:scope = 'provided']"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + <xsl:apply-templates select="pom:dependency[not(pom:scope) or pom:scope = 'compile']"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + <xsl:apply-templates select="pom:dependency[pom:scope = 'runtime']"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + <xsl:apply-templates select="pom:dependency[pom:scope = 'test']"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + </dependencies> + </xsl:template> + <xsl:template match="pom:exclusions"> + <exclusions> + <xsl:apply-templates select="pom:exclusion"> + <xsl:sort select="concat(pom:artifactId, ' ', pom:groupId)" /> + </xsl:apply-templates> + </exclusions> + </xsl:template> + <!-- standard copy template --> + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates /> + </xsl:copy> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file