maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Václav Haisman (JIRA) <j...@apache.org>
Subject [jira] [Commented] (MNG-6541) less restrictive "is referencing itself" check
Date Sat, 22 Dec 2018 12:55:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-6541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16727401#comment-16727401
] 

Václav Haisman commented on MNG-6541:
-------------------------------------

[~rfscholte] I do not think that will solve anything with respect to the self reference check,
which seems to come from this code, which checks only {{groupId:artifactId:version}} key.
From {{DefaultModelValidator}}:

{code:java}
    private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems,
Model m,
                                                           List<Dependency> dependencies,
String prefix,
                                                           ModelBuildingRequest request )
    {
        // We only check for groupId/artifactId cause if there is another
        // module with the same groupId/artifactId this will fail the build
        // earlier like "Project '...' is duplicated in the reactor.
        // So it is sufficient to check only groupId/artifactId and not the
        // packaging type.
        for ( Dependency dependency : dependencies )
        {
            String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":"
+ dependency.getVersion();
            String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion();
            if ( key.equals( mKey ) )
            {
                // This means a module which is build has a dependency which has the same
                // groupId, artifactId and version coordinates. This is in consequence
                // a self reference or in other words a circular reference which can not
                // being resolved.
                addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key,
"is referencing itself.",
                              dependency );

            }
        }
    }
{code}

> less restrictive "is referencing itself" check
> ----------------------------------------------
>
>                 Key: MNG-6541
>                 URL: https://issues.apache.org/jira/browse/MNG-6541
>             Project: Maven
>          Issue Type: Wish
>          Components: Dependencies
>    Affects Versions: 3.5.4
>            Reporter: Václav Haisman
>            Priority: Major
>
> I have issues when building site:site in project with OpenJFX. The javafx-graphics artifact
sort of references itself:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>org.openjfx</groupId>
>   <artifactId>javafx-graphics</artifactId>
>   <version>11.0.1</version>
>   <parent>
>     <groupId>org.openjfx</groupId>
>     <artifactId>javafx</artifactId>
>     <version>11.0.1</version>
>   </parent>
>   <dependencies>
>     <dependency>
>       <groupId>org.openjfx</groupId>
>       <artifactId>javafx-graphics</artifactId>
>       <version>11.0.1</version>
>       <classifier>${javafx.platform}</classifier>
>     </dependency>
>     <dependency>
>       <groupId>org.openjfx</groupId>
>       <artifactId>javafx-base</artifactId>
>       <version>11.0.1</version>
>     </dependency>
>   </dependencies>
> </project>
> {code}
> But it does so with additional classifier. When I run site:site, it gives me this:
> {code}
> [WARNING] Unable to create Maven project from repository.
> org.apache.maven.project.ProjectBuildingException: 1 problem was encountered while building
the effective model for org.openjfx:javafx-graphics:11.0.1
> [FATAL] 'dependencies.dependency org.openjfx:javafx-graphics:11.0.1' for org.openjfx:javafx-graphics:11.0.1
is referencing itself. @ line 13, column 17
>  for project org.openjfx:javafx-graphics:11.0.1
>     at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:165)
>     at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:327)
>     at org.apache.maven.report.projectinfo.dependencies.RepositoryUtils.getMavenProjectFromRepository
(RepositoryUtils.java:125)
> {code}
> I was wondering if the check could not be relaxed to accommodate this situation that
seems to be common even in core Java components?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message