You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Nigel Jones (Jira)" <ji...@apache.org> on 2020/07/20 08:11:00 UTC

[jira] [Commented] (MASSEMBLY-940) moduleSet - incorrect binary dependencies added to assembly

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

Nigel Jones commented on MASSEMBLY-940:
---------------------------------------

Full assembly : 

 

[https://gist.github.com/planetf1/4bef80e8454b3e57a3a8d948775abaf4]

From the log of a build:



For that last example which has a handful of dependencies, what I actually see the assembly plugin reporting is:

17:11:33,629 [DEBUG] Dependencies for project: org.odpi.egeria:open-metadata-conformance-suite-client:jar:2.1-SNAPSHOT are:

17:11:33,629 [DEBUG] First version:2.1-SNAPSHOT
17:11:33,629 [DEBUG] -> checking org.odpi.egeria:open-metadata-conformance-suite-client:jar:2.1-SNAPSHOT
17:11:33,629 [DEBUG] Processing binary dependencies for module project: org.odpi.egeria:open-metadata-conformance-suite-client:jar:2.1-SNAPSHOT
17:11:33,630 [DEBUG] Processing DependencySet (output=./conformance-suite)
17:11:33,630 [DEBUG] Filtering dependency artifacts WITHOUT transitive dependency path information.
17:11:33,630 [DEBUG] org.slf4j:slf4j-simple:jar:1.7.30 was removed by one or more filters.
17:11:33,630 [DEBUG] Adding 470 dependency artifacts.

There's the 470.... but why. That definately looks more like the overall project -- though if I do a pstree on the dependencies of this module, I actually resolve to 213 dependencies.


Each time 470 .... yet the actual number (as above) should be a lot smaller and indeed should differ from moduleSet to moduleSet whereas in this case they do not

> moduleSet - incorrect binary dependencies added to assembly 
> ------------------------------------------------------------
>
>                 Key: MASSEMBLY-940
>                 URL: https://issues.apache.org/jira/browse/MASSEMBLY-940
>             Project: Maven Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>            Reporter: Nigel Jones
>            Priority: Major
>
> In moduleSet, dependencies are not based on specific modules included:
> I have a large multimodule project (https://github.com/odpi/egeria) which has over 300 modules, mostly java (->jar).
> One of our submodules is responsible for creating the composite assembly. Previously we were doing it 'the wrong way' (IMO) with lots of relative paths (../../.. etc) and I've recently been trying to switch to using moduleSets, and follow best practices for assembly. We were also previously doing lots of building 'jar with dependencies' but this doesn't scale as every possibly useful for ends up far too big...
> I have hit a problem with dependencies and moduleSets
> We have a series of 'client' artifacts. These have some dependencies (for example we use restclient from spring, jackson etc). One section of my assembly attempts to package the clients into a folder, and include any dependencies they may need:
> <!-- Clients -->
>  <moduleSet>
>  <useAllReactorProjects>true</useAllReactorProjects>
>  <includes>
>  <include>org.odpi.egeria:asset-catalog-client:*</include>
>  <include>org.odpi.egeria:asset-consumer-client:*</include>
>  <include>org.odpi.egeria:asset-owner-client:*</include>
>  <include>org.odpi.egeria:community-profile-client:*</include>
>  <include>org.odpi.egeria:data-engine-client:*</include>
>  <include>org.odpi.egeria:it-infrastructure-client:*</include>
>  <include>org.odpi.egeria:it-infrastructure-client:*</include>
>  <include>org.odpi.egeria:data-manager-client:*</include>
>  <include>org.odpi.egeria:data-privacy-client:*</include>
>  <include>org.odpi.egeria:data-science-client:*</include>
>  <include>org.odpi.egeria:dev-ops-client:*</include>
>  <include>org.odpi.egeria:digital-architecture-client:*</include>
>  <include>org.odpi.egeria:discovery-engine-client:*</include>
>  <include>org.odpi.egeria:governance-engine-client:*</include>
>  <include>org.odpi.egeria:governance-program-client:*</include>
>  <include>org.odpi.egeria:information-view-client:*</include>
>  <include>org.odpi.egeria:project-management-client:*</include>
>  <include>org.odpi.egeria:security-officer-client:*</include>
>  <include>org.odpi.egeria:software-developer-client:*</include>
>  <include>org.odpi.egeria:stewardship-action-client:*</include>
>  <include>org.odpi.egeria:subject-area-client:*</include>
>  <include>org.odpi.egeria:admin-services-client:*</include>
>  <include>org.odpi.egeria:project-management-client:*</include>
>  </includes>
>  <binaries>
>  <outputDirectory>./clients</outputDirectory>
>  <unpack>false</unpack>
>  <includeDependencies>true</includeDependencies>
>  </binaries>
> We have a similar pattern for utilities, samples, connectors etc.
> I had thought 'includeDependencies' would JUST pull in dependencies for the modules listed in the included. However I seem to get every dependency for the entire project (reactor)
> I then tried:
> <includeDependencies>false</includeDependencies>
>  <dependencySets>
>  </dependencySets>
> instead, with the same result.
> Then switched to this -- since the pom for the module doing the assembly DOES have a lot of dependencies (in fact it needs to be everything the assembly refers to as a module, so that we ensure those modules are built first - and exist) - so thinking (but unsure) if useProjectArtifact was relevant:
> <includeDependencies>false</includeDependencies>
>  <dependencySet>
>  <useTransitiveDependencies>true</useTransitiveDependencies>
>  <useProjectArtifact>false</useProjectArtifact>
>  <useProjectAttachments>false</useProjectAttachments>
>  </dependencySet>
> but yet again this still pulls in all dependencies.
> The results are inconsistent with 'mvn dependency:tree' - and in fact whatever is built I just always seem to get the same. It's not transitively based off every module in the reactor, but seems to be based of the pom of the project containing the assembly.
> Shouldn't I just be pulling in dependencies of the binaries I specify in the moduleSet?
> I've read the definitive maven book chapter, and the docs, but I can't quite figure out what I'm missing here.
> To clarify as well, here's another example
> <!-- Conformance Suite -->
>  <moduleSet>
>  <useAllReactorProjects>true</useAllReactorProjects>
>  <includes>
>  <include>org.odpi.egeria:open-metadata-conformance-suite-client:*</include>
>  </includes>
>  <binaries>
>  <outputDirectory>./conformance-suite</outputDirectory>
>  <unpack>false</unpack>
>  <includeDependencies>false</includeDependencies>
>  <dependencySets>
>  <dependencySet>
>  <useTransitiveDependencies>true</useTransitiveDependencies>
>  <useProjectArtifact>false</useProjectArtifact>
>  <useProjectAttachments>false</useProjectAttachments>
>  </dependencySet>
>  </dependencySets>
>  </binaries>
>  </moduleSet>
> Again, I get the same dependencies - this time into ./conformance-suite yet that is just a single module I am putting into that dir - and I can simply show
> [INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ open-metadata-conformance-suite-client ---
> [INFO] org.odpi.egeria:open-metadata-conformance-suite-client:jar:2.1-SNAPSHOT
> [INFO] +- org.odpi.egeria:open-metadata-conformance-suite-api:jar:2.1-SNAPSHOT:compile
> [INFO] | +- org.slf4j:slf4j-api:jar:1.7.30:compile
> [INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.1:compile
> [INFO] +- org.odpi.egeria:rest-client-connectors-api:jar:2.1-SNAPSHOT:compile
> [INFO] | \- org.odpi.egeria:open-connector-framework:jar:2.1-SNAPSHOT:compile
> [INFO] | \- org.odpi.egeria:audit-log-framework:jar:2.1-SNAPSHOT:compile
> [INFO] +- org.odpi.egeria:rest-client-factory:jar:2.1-SNAPSHOT:compile
> [INFO] | \- org.odpi.egeria:spring-rest-client-connector:jar:2.1-SNAPSHOT:compile
> [INFO] | +- org.springframework:spring-web:jar:5.2.7.RELEASE:compile
> [INFO] | | \- org.springframework:spring-beans:jar:5.2.7.RELEASE:compile
> [INFO] | +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
> [INFO] | \- org.springframework:spring-core:jar:5.2.7.RELEASE:compile
> [INFO] | \- org.springframework:spring-jcl:jar:5.2.7.RELEASE:compile
> [INFO] +- commons-io:commons-io:jar:2.7:compile
> [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.1:compile
> [INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.1:compile
> [INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
> [INFO] | \- ch.qos.logback:logback-core:jar:1.2.3:compile
> [INFO] \- org.slf4j:slf4j-simple:jar:1.7.30:test
> not so bad, yet deposited into that directory is my usual set of 462 or so jars..



--
This message was sent by Atlassian Jira
(v8.3.4#803005)