You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by Svante Schubert <sv...@apache.org> on 2022/08/24 10:55:24 UTC

Problem with RAT in conjunction - basedir & multi-pom repo

Dear developers, (dear Philipp - met you at ApacheCon in Berlin)

Perhaps you have stumbled over the same problem or heard about a solution.
This is not necessarily an issue of rat (therefore no issue written), but
it occurs with rat:

*Problem:*
In a multi-pom repository, I receive the error message
*[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.14:check
(default) on project schema2template: Cannot read header:
src/main/java/schema2template/OutputFileListEntry.java (No such file or
directory)*

But when '*mvn clean install -Ppedantic*' is being called from the project
root. But if you execute the call directly from the subdirectory (a sub-sub
pom.xml in generator/schema2template)  it works fine.

You might quickly reproduce by:
*git clone -b pedantic-problem  https://github.com/tdf/odftoolkit
<https://github.com/tdf/odftoolkit>*
*cd odftoolkit*
*mvn clean install -Ppedantic*

I checked the latest RAT build, on Windows (with old Maven 3.6.3 and the
latest 3.8.6 on Windows) and Linux with 3.8.3 all the same behaviour.
Finally, it still works on my main branch, but there are a lot of changes
in the pom.xml (as I forgot to build with RAT for quite a while).

Any ideas/suggestions?

Thanks in advance,
Svante

Re: Problem with RAT in conjunction - basedir & multi-pom repo

Posted by "P. Ottlinger" <po...@apache.org>.
Hi Svante,

thanks for reaching out ..... I don't really know what causes the 
problem, but we saw similar issues among various JDK versions in the 
past. This happened when scanning for RAT-ignores derived from 
SVN/Git-Ignore files.

There will be a release of RAT 0.15 in September (hopefully ;)) which 
changes the way we inherit stuff within RAT itself - maybe this changes 
your behaviour as well ....

I'm not sure if fellow RAT-users have a clue or something to add to your 
problem.

Cheers,
Phil

Am 24.08.22 um 21:20 schrieb Svante Schubert:
> In the end, it seems to be a RAT problem in conjunction with the surefire
> plugin having explicitly no forks.

Re: Problem with RAT in conjunction - basedir & multi-pom repo

Posted by Svante Schubert <sv...@apache.org>.
In the end, it seems to be a RAT problem in conjunction with the surefire
plugin having explicitly no forks.

If I am using the surefire-plugin with <forkCount>0</forkCount>
<https://github.com/tdf/odftoolkit/blob/debug/generator/schema2template/pom.xml#L132>
RAT does not work, as in this case the user.dir system variable - which is
usually the calling root directory - changes strangely to the subproject
defining the forkCount at least during the RAT call.

And RAT is taking the user.dir into account and if user.dir is the same as
the basedir the basedir becomes null, see
https://github.com/apache/creadur-rat/blob/master/apache-rat-plugin/src/main/java/org/apache/rat/mp/FilesReportable.java#L49

I have created myself debug Version of RAT with some println at
https://github.com/svanteschubert/creadur-rat/blob/debug/apache-rat-plugin/src/main/java/org/apache/rat/mp/FilesReportable.java#L49

And a stripped version of my project as well in the debug branch:
https://github.com/tdf/odftoolkit/tree/debug

You may reproduce the problem:

1) Check out debug rat
git clone -b debug https://github.com/svanteschubert/creadur-rat
cd creadur-rat
mvn install

2) Check out my stripped project (which is referencing to my debug rat, I
called 0.15-Svante)
git clone -b debug https://github.com/tdf/odftoolkit
cd odftoolkit
mvn install -Ppedantic

The above should work...

3) Now uncomment the surfire configuration of the fork:
https://github.com/tdf/odftoolkit/blob/debug/generator/schema2template/pom.xml#L132

4) Run again from the project root: mvn install -Ppedantic
This should fail.

Curious about the origin of the problem, but I got a workaround now!
Thx in advance,
Svante

PS: My "mvn --version" shows
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /opt/apache-maven-3.8.3
Java version: 17.0.4, vendor: Private Build, runtime:
/usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-46-generic", arch: "amd64", family:
"UNIX"

but I could reproduce it as well on windows
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: E:\tools\apache-maven-3.8.6
Java version: 17.0.4, vendor: Oracle Corporation, runtime:
C:\Programme\java\jdk-17.0.4
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

PPS: I have uploaded two logs, one without fork (working)
<https://github.com/tdf/odftoolkit/blob/debug/rat-works.txt> and one with
work (failing) <https://github.com/tdf/odftoolkit/blob/debug/rat-fails.txt>


Am Mi., 24. Aug. 2022 um 12:55 Uhr schrieb Svante Schubert <
svanteschubert@apache.org>:

> Dear developers, (dear Philipp - met you at ApacheCon in Berlin)
>
> Perhaps you have stumbled over the same problem or heard about a solution.
> This is not necessarily an issue of rat (therefore no issue written), but
> it occurs with rat:
>
> *Problem:*
> In a multi-pom repository, I receive the error message
> *[ERROR] Failed to execute goal
> org.apache.rat:apache-rat-plugin:0.14:check (default) on project
> schema2template: Cannot read header:
> src/main/java/schema2template/OutputFileListEntry.java (No such file or
> directory)*
>
> But when '*mvn clean install -Ppedantic*' is being called from the
> project root. But if you execute the call directly from the subdirectory (a
> sub-sub pom.xml in generator/schema2template)  it works fine.
>
> You might quickly reproduce by:
> *git clone -b pedantic-problem  https://github.com/tdf/odftoolkit
> <https://github.com/tdf/odftoolkit>*
> *cd odftoolkit*
> *mvn clean install -Ppedantic*
>
> I checked the latest RAT build, on Windows (with old Maven 3.6.3 and the
> latest 3.8.6 on Windows) and Linux with 3.8.3 all the same behaviour.
> Finally, it still works on my main branch, but there are a lot of changes
> in the pom.xml (as I forgot to build with RAT for quite a while).
>
> Any ideas/suggestions?
>
> Thanks in advance,
> Svante
>