Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another issue with add-third-party on Windows with version 2.5.0 #624

Open
RalfSchumacher opened this issue Feb 10, 2025 · 7 comments
Open

Comments

@RalfSchumacher
Copy link

RalfSchumacher commented Feb 10, 2025

After switching from 2.4.0 to 2.5.0, on windows only, the plugin reports the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:2.4.0:add-third-party (add-third-party) on project
my-project: There are some forbidden licenses used, please check your dependencies. -> [Help 1]

It seems, that my license configuration is not used anymore.

The plugin works fine in linux environments.

Example plugin configuration:

<configuration>
    <licenseName>my-project-</licenseName>
    <includedLicenses>file:${project.basedir}/../../license/included-licenses.txt</includedLicenses>
    <licenseMergesUrl>file:${project.basedir}/../../license/license-merges.txt</licenseMergesUrl>
    <missingFile>${project.basedir}/../../license/missing.properties</missingFile>
    <fileTemplate>${project.basedir}/../../license/template.ftl</fileTemplate>
    <outputDirectory>${project.basedir}/target/generated-sources/license</outputDirectory>
    <thirdPartyFilename>license_${project.artifactId}.csv</thirdPartyFilename>
    <excludedGroups>my.project.*</excludedGroups>
    <includeTransitiveDependencies>true</includeTransitiveDependencies>
    <failOnBlacklist>true</failOnBlacklist>
    <failOnMissing>true</failOnMissing>
</configuration>

I am using a mono repo and have a central licence configuration which is placed outside the current module ("../.."), so that it can be reused by other modules as well.

@spyro2000
Copy link

spyro2000 commented Feb 12, 2025

Same here, the file was completely ignored, worked with 2.4.0.

My config:

 <configuration>
                    <licenseName>project_license</licenseName>
                    <includedLicenses>file:${project.basedir}/build/license/compliance-license.txt</includedLicenses>
                    <licenseMergesUrl>file:${project.basedir}/build/license/merge-license.txt</licenseMergesUrl>
                    <missingFile>${project.basedir}/build/license/third-party-missing.properties</missingFile>
                    <fileTemplate>${project.basedir}/build/license/third-party-file-template.ftl</fileTemplate>
                    <outputDirectory>${project.basedir}/target/generated-sources/license</outputDirectory>
                    <thirdPartyFilename>license_${project.artifactId}.csv</thirdPartyFilename>
                    <excludedGroups>com.my.group.*</excludedGroups>
                    <includeTransitiveDependencies>true</includeTransitiveDependencies>
                    <failOnBlacklist>true</failOnBlacklist>
                    <failOnMissing>true</failOnMissing>
                </configuration>

@slawekjaranowski
Copy link
Member

One change that can be connected with it maybe it: #609

can you try to change: file:${project.basedir} to ${project.baseUri}

@slawekjaranowski
Copy link
Member

Looks similar to #615

@RalfSchumacher
Copy link
Author

RalfSchumacher commented Feb 13, 2025

One change that can be connected with it maybe it: #609

I also think it's connected with pull request 609.
The logic to access files has been changed. Instead of using standard java classes, a library from apache is used now.
Unfortunately test coverage is quite low, so that the changes from this pull request did not break any existing test.

can you try to change: file:${project.basedir} to ${project.baseUri}

Yes, baseUri is working!
Thanks for this hint, I will change my configuration.

Looks similar to #615

I think 615 is not related to this error and also not to the plugin itself. It's rather an issue with the local build environment. In the past I got the error " Illegal character in path at index ..." if my java runtime running the maven build was different to the java environment requested in the pom.xml. I could fix those issue by swithing locally to the correct java runtime (try java -version)

@spyro2000
Copy link

Soo, this was just not tested with Windows, it seems. Ok, now we know that it does break it.

Could this be reverted or fixed, please? :)

@slawekjaranowski
Copy link
Member

looks like used uri is not correct ... file:${project.basedir} - should be file://${project.basedir}
or ${project.baseUri}

https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/URI.html

@slawekjaranowski
Copy link
Member

but yes should be reported that file can not be opened ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants