This is an automated email from the ASF dual-hosted git repository.
jochen pushed a commit to branch feature/RAT-397
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
The following commit(s) were added to refs/heads/feature/RAT-397 by this push:
new ee349799 RAT-379: Resources from the parent project are no longer
handled by the maven-resources-plugin.
ee349799 is described below
commit ee349799e03b6c713820b2efc96598436a206477
Author: Jochen Wiedmann <[email protected]>
AuthorDate: Mon Dec 2 15:25:03 2024 +0100
RAT-379: Resources from the parent project are no longer handled by the
maven-resources-plugin.
---
apache-rat-core/pom.xml | 36 ++++++++++---
.../copyResourcesFromParentProject.groovy | 59 ++++++++++++++++++++++
apache-rat-plugin/pom.xml | 28 +++++++---
apache-rat-tasks/pom.xml | 24 ++++++---
apache-rat-tools/pom.xml | 28 +++++++---
apache-rat/pom.xml | 40 +++++++++++----
.../copyResourcesFromParentProject.groovy | 59 ++++++++++++++++++++++
pom.xml | 6 +++
src/changes/changes.xml | 3 ++
9 files changed, 244 insertions(+), 39 deletions(-)
diff --git a/apache-rat-core/pom.xml b/apache-rat-core/pom.xml
index 8a500a5f..5eb639ef 100644
--- a/apache-rat-core/pom.xml
+++ b/apache-rat-core/pom.xml
@@ -36,13 +36,6 @@
<filtering>true</filtering>
<directory>src/main/filtered-resources</directory>
</resource>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </resource>
</resources>
<pluginManagement>
<plugins>
@@ -51,6 +44,12 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<!-- These files have bad license headers because they are used
to test bad license headers -->
<exclude>src/test/resources/**</exclude>
<exclude>src/it/resources/ReportTest/**</exclude>
@@ -136,6 +135,29 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.github.jochenw.jmp</groupId>
+ <artifactId>jwigrv-maven-plugin</artifactId>
+ <version>0.2</version>
+ <executions>
+ <execution>
+ <!-- Copy a set of resource files from the parent project to
target/classes/META-INF,
+ so that they become a part of the generated jar file. See RAT-379.
+ -->
+ <phase>generate-resources</phase>
+ <goals><goal>run</goal></goals>
+ <configuration>
+
<scriptFile>src/main/build-grv/copyResourcesFromParentProject.groovy</scriptFile>
+ <scriptProperties>
+ <sourceDir>${basedir}/..</sourceDir>
+ <targetDir>${project.build.outputDirectory}/META-INF</targetDir>
+ <!-- Comma separated list of files, which are being copied -->
+ <filesToCopy>RELEASE_NOTES.txt</filesToCopy>
+ </scriptProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
diff --git
a/apache-rat-core/src/main/build-grv/copyResourcesFromParentProject.groovy
b/apache-rat-core/src/main/build-grv/copyResourcesFromParentProject.groovy
new file mode 100644
index 00000000..285b8d43
--- /dev/null
+++ b/apache-rat-core/src/main/build-grv/copyResourcesFromParentProject.groovy
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+// Copy a set of resource files from the parent project to
target/classes/META-INF,
+// so that they become a part of the generated jar file. See RAT-379.
+
+import java.io.FileNotFoundException;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+final Path sourceDir = Paths.get("${sourceDir}");
+final Path targetDir = Paths.get("${targetDir}");
+if (!Files.isDirectory(sourceDir)) {
+ final String msg = "Source directory not found: " +
sourceDir.toAbsolutePath();
+ log.error(msg);
+ throw new FileNotFoundException(msg);
+}
+log.debug("copyResourcesFromParent: Using source directory " + sourceDir + ",
resolved to " + sourceDir.toAbsolutePath());
+log.debug("copyResourcesFromParent: Using target directory " + targetDir + ",
resolved to " + targetDir.toAbsolutePath());
+Files.createDirectories(targetDir);
+for (StringTokenizer st = new StringTokenizer("${filesToCopy}", ",");
st.hasMoreTokens(); ) {
+ final String token = st.nextToken();
+ final Path sourceFile = sourceDir.resolve(token);
+ if (!Files.isRegularFile(sourceFile)) {
+ final String msg = "Source file " + token + " not found in
source directory " + sourceDir;
+ log.error("copyResourcesFromParent: " + msg);
+ log.error("copyResourcesFromParent: A possible reason is, that
you did clone only the apache-rat-core subproject from Git.");
+ throw new FileNotFoundException(msg);
+ }
+ final Path targetFile = targetDir.resolve(token);
+ if (Files.isRegularFile(targetFile)) {
+ final FileTime sourceTime =
Files.getLastModifiedTime(sourceFile);
+ final FileTime targetTime =
Files.getLastModifiedTime(targetFile);
+ if (sourceTime != null && targetTime != null &&
sourceTime.compareTo(targetTime) >= 0) {
+ log.debug("copyResourcesFromParent: Skipping source
file "
+ + sourceFile + ", because target file " +
targetFile + " appears to be uptodate.");
+ continue;
+ }
+ }
+ log.debug("copyResourcesFromParent: Copying source file " + sourceFile
+ + " to target file " + targetFile);
+ Files.copy(sourceFile, targetFile);
+}
diff --git a/apache-rat-plugin/pom.xml b/apache-rat-plugin/pom.xml
index 951614fd..66cff432 100644
--- a/apache-rat-plugin/pom.xml
+++ b/apache-rat-plugin/pom.xml
@@ -46,13 +46,6 @@
<filtering>true</filtering>
<directory>src/main/filtered-resources</directory>
</resource>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </resource>
</resources>
<testResources>
<testResource>
@@ -92,6 +85,12 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<!-- These files do not have license headers because they are
used to test license headers -->
<exclude>src/it/**</exclude>
<exclude>src/it/**/src.apt</exclude>
@@ -254,6 +253,21 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals><goal>unpack-dependencies</goal></goals>
+ <configuration>
+ <includeArtifactIds>apache-rat-core</includeArtifactIds>
+ <includes>META-INF/RELEASE_NOTES.txt</includes>
+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
diff --git a/apache-rat-tasks/pom.xml b/apache-rat-tasks/pom.xml
index 32f7b5d7..8fc634bf 100644
--- a/apache-rat-tasks/pom.xml
+++ b/apache-rat-tasks/pom.xml
@@ -82,13 +82,6 @@
<filtering>true</filtering>
<directory>src/main/filtered-resources</directory>
</resource>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </resource>
</resources>
<plugins>
<plugin>
@@ -96,6 +89,7 @@
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
+ <id>generate-test-resources</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-dependencies</goal>
@@ -106,6 +100,16 @@
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
</configuration>
</execution>
+ <execution>
+ <id>generate-resources</id>
+ <phase>generate-resources</phase>
+ <goals><goal>unpack-dependencies</goal></goals>
+ <configuration>
+ <includeArtifactIds>apache-rat-core</includeArtifactIds>
+ <includes>META-INF/RELEASE_NOTES.txt</includes>
+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -242,6 +246,12 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<!-- These files do not have license headers -->
<exclude>src/test/resources/</exclude>
<exclude>src/site/apt/*.txt</exclude>
diff --git a/apache-rat-tools/pom.xml b/apache-rat-tools/pom.xml
index a7e98914..c36d51c0 100644
--- a/apache-rat-tools/pom.xml
+++ b/apache-rat-tools/pom.xml
@@ -36,13 +36,6 @@
<filtering>true</filtering>
<directory>src/main/filtered-resources</directory>
</resource>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- </includes>
- </resource>
</resources>
<pluginManagement>
<plugins>
@@ -51,6 +44,12 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<!-- This file is included into a generated file. -->
<exclude>src/main/resources/Args.tpl</exclude>
<exclude>src/main/resources/ant/report.tpl</exclude>
@@ -59,6 +58,21 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals><goal>unpack-dependencies</goal></goals>
+ <configuration>
+ <includeArtifactIds>apache-rat-core</includeArtifactIds>
+ <includes>META-INF/RELEASE_NOTES.txt</includes>
+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
diff --git a/apache-rat/pom.xml b/apache-rat/pom.xml
index 55916e53..02ec1089 100644
--- a/apache-rat/pom.xml
+++ b/apache-rat/pom.xml
@@ -42,17 +42,6 @@
</dependency>
</dependencies>
<build>
- <resources>
- <resource>
- <directory>..</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>RELEASE_NOTES.txt</include>
- <include>LICENSE</include>
- <include>NOTICE</include>
- </includes>
- </resource>
- </resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -211,6 +200,29 @@
</filesets>
</configuration>
</plugin>
+ <plugin>
+ <groupId>com.github.jochenw.jmp</groupId>
+ <artifactId>jwigrv-maven-plugin</artifactId>
+ <version>0.2</version>
+ <executions>
+ <execution>
+ <!-- Copy a set of resource files from the parent project to
target/classes/META-INF,
+ so that they become a part of the generated jar file. See
RAT-379.
+ -->
+ <phase>generate-resources</phase>
+ <goals><goal>run</goal></goals>
+ <configuration>
+
<scriptFile>src/main/build-grv/copyResourcesFromParentProject.groovy</scriptFile>
+ <scriptProperties>
+ <sourceDir>${basedir}/..</sourceDir>
+
<targetDir>${project.build.outputDirectory}/META-INF</targetDir>
+ <!-- Comma separated list of files, which are being copied -->
+ <filesToCopy>RELEASE_NOTES.txt,LICENSE,NOTICE</filesToCopy>
+ </scriptProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -219,6 +231,12 @@
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<!-- These files only describe how to use the project and they
have no license headers -->
<exclude>README-ANT.txt</exclude>
diff --git
a/apache-rat/src/main/build-grv/copyResourcesFromParentProject.groovy
b/apache-rat/src/main/build-grv/copyResourcesFromParentProject.groovy
new file mode 100644
index 00000000..285b8d43
--- /dev/null
+++ b/apache-rat/src/main/build-grv/copyResourcesFromParentProject.groovy
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+// Copy a set of resource files from the parent project to
target/classes/META-INF,
+// so that they become a part of the generated jar file. See RAT-379.
+
+import java.io.FileNotFoundException;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+final Path sourceDir = Paths.get("${sourceDir}");
+final Path targetDir = Paths.get("${targetDir}");
+if (!Files.isDirectory(sourceDir)) {
+ final String msg = "Source directory not found: " +
sourceDir.toAbsolutePath();
+ log.error(msg);
+ throw new FileNotFoundException(msg);
+}
+log.debug("copyResourcesFromParent: Using source directory " + sourceDir + ",
resolved to " + sourceDir.toAbsolutePath());
+log.debug("copyResourcesFromParent: Using target directory " + targetDir + ",
resolved to " + targetDir.toAbsolutePath());
+Files.createDirectories(targetDir);
+for (StringTokenizer st = new StringTokenizer("${filesToCopy}", ",");
st.hasMoreTokens(); ) {
+ final String token = st.nextToken();
+ final Path sourceFile = sourceDir.resolve(token);
+ if (!Files.isRegularFile(sourceFile)) {
+ final String msg = "Source file " + token + " not found in
source directory " + sourceDir;
+ log.error("copyResourcesFromParent: " + msg);
+ log.error("copyResourcesFromParent: A possible reason is, that
you did clone only the apache-rat-core subproject from Git.");
+ throw new FileNotFoundException(msg);
+ }
+ final Path targetFile = targetDir.resolve(token);
+ if (Files.isRegularFile(targetFile)) {
+ final FileTime sourceTime =
Files.getLastModifiedTime(sourceFile);
+ final FileTime targetTime =
Files.getLastModifiedTime(targetFile);
+ if (sourceTime != null && targetTime != null &&
sourceTime.compareTo(targetTime) >= 0) {
+ log.debug("copyResourcesFromParent: Skipping source
file "
+ + sourceFile + ", because target file " +
targetFile + " appears to be uptodate.");
+ continue;
+ }
+ }
+ log.debug("copyResourcesFromParent: Copying source file " + sourceFile
+ + " to target file " + targetFile);
+ Files.copy(sourceFile, targetFile);
+}
diff --git a/pom.xml b/pom.xml
index 934558eb..6d031055 100644
--- a/pom.xml
+++ b/pom.xml
@@ -459,6 +459,12 @@ agnostic home for software distribution comprehension and
audit tools.
<version>0.16.1</version>
<configuration>
<excludes>
+ <!-- Automatically generated by Eclipse, thus ignorable. -->
+ <exclude>.classpath</exclude>
+ <exclude>.project</exclude>
+ <exclude>.settings/**/*</exclude>
+ <exclude>bin/**/*</exclude>
+
<exclude>.asf.yaml</exclude>
<exclude>BUILD.txt</exclude>
<!-- rat:check does not seem to use exclusions from modules -->
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 986def59..410fcf0b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -291,6 +291,9 @@ The <action> type attribute can be one of:
<action issue="RAT-345" type="update" dev="pottlinger"
due-to="dependabot">
TODO: collect all dependabot updates for release 0.17.
</action>
+ <action issue="RAT-379" type="fix" dev="jochen">
+ The project sources are importable into Eclipse.
+ </action>
</release>
<release version="0.16.1" date="2024-01-24" description=
"As release 0.16 introduced breaking changes concerning the configurability of
the Maven plugin, these configuration options are reintroduced albeit as
deprecated elements.