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

Unclear url for a dependency #369

Open
lrozenblyum opened this issue Mar 2, 2020 · 3 comments
Open

Unclear url for a dependency #369

lrozenblyum opened this issue Mar 2, 2020 · 3 comments

Comments

@lrozenblyum
Copy link
Contributor

lrozenblyum commented Mar 2, 2020

Let's have a pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.leokom</groupId>
<artifactId>license-maven-test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jboss.spec.javax.interceptor</groupId>
<artifactId>jboss-interceptors-api_1.1_spec</artifactId>
<version>1.0.0.Beta1</version>
</dependency>
</dependencies>
</project>

Maven: 3.6.3
Run
mvn license:add-third-party
Check the output license file for org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:1.0.0.Beta1 entry

Expected:
the url is either empty (as not defined in the dependency pom.xml) or equals to http://www.jboss.org (as defined in the dependency's parent pom.xml)

Actually:
the url is: http://jboss-interceptors-api_1.1_spec/
something strange, looks like based on artifactId

@Jojor
Copy link

Jojor commented Apr 28, 2020

I may have a similar issue, with guava dependency it generates the following URLs:

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>28.2-jre</version>
    </dependency>
(The Apache Software License, Version 2.0) Guava InternalFutureFailureAccess and InternalFutures (com.google.guava:failureaccess:1.0.1 - https://github.com/google/guava/failureaccess)
(Apache License, Version 2.0) Guava: Google Core Libraries for Java (com.google.guava:guava:28.2-jre - https://github.com/google/guava/guava)
(The Apache Software License, Version 2.0) Guava ListenableFuture only (com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava - https://github.com/google/guava/listenablefuture)

URLs https://github.com/google/guava/guava gives a 404 not found on GitHub because the correct URL is https://github.com/google/guava/. It looks like the artifact id is also append to the base url that is correctly set in the library's pom.

I'm using version 2.0.0

@JSurf
Copy link

JSurf commented Sep 30, 2021

Currently experiencing a similar issue where the artifactid is appended to the url of a parent pom.
Seems this is caused by maven behaviour:

Notice that the 5 URLs from the model (project.url, project.scm.connection, project.scm.developerConnection, project.scm.url and project.distributionManagement.site.url) have a special inheritance handling:

if not configured in current model, the inherited value is the parent's one with current artifact id appended,
since Maven 3.5.0, if project.directory POM property value is defined, it is used instead of artifact id: this permits default inheritance calculations when module directory name is not equal to artifact id. Notice that this property is not inherited from a POM to its child: childs POM will use child artifact id if property is not set.
since Maven 3.6.1, inheritance can avoid appending any path to parent value by setting model attribute value to false for each url: project/@child.project.url.inherit.append.path, project/distributionManagement/site/@child.site.url.inherit.append.path, project/scm/@child.scm.connection.inherit.append.path, project/scm/@child.scm.developerConnection.inherit.append.path and project/scm/@child.scm.url.inherit.append.path.

See:
https://maven.apache.org/ref/3.6.1/maven-model-builder/

Seems there is no way around this from "client" side. Package maintainer would need to fix their poms in either setting the url in every child pom or use the child.project.url.inherit.append.path setting.

@JSurf
Copy link

JSurf commented Sep 30, 2021

btw. maybe there should be a way to override the URL like it is possible with the license in THIRD-PARTY.properties ?

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