You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/04/26 12:02:35 UTC

[GitHub] [maven-assembly-plugin] cstamas opened a new pull request, #55: Do not download whole universe

cstamas opened a new pull request, #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55

   Problem: try to build maven master with empty repository,
   you will notice that we get things from repository.sonatype.org
   repository, that is wrong. Moreover, if you look carefully, you
   will notice that we download/resolve totally unrelated things
   to our build, like felix plugin etc. For fun, it downloads
   Maven 2.2.0, Maven 2.0.7 etc as well.
   
   Without PR:
   https://gist.github.com/cstamas/badb32a25dbe444679774611f61d94b1
   
   Reason: m-assembly-p "rebuilds" all the project of depSet to
   get MavenProject instance of them and transitive deps, but alas,
   it was doing it too eagerly: it was getting even plugins that
   built our dependendencies, while we are really not want them.
   So, instead to re-use the "project building request" of
   currently built project, just create a simple PBR that is
   tuned "just enough" to get results we want, nothing more.
   We do not want the plugins that built our dependencies.
   
   With PR:
   https://gist.github.com/cstamas/1e9dfd0384dceda7a8195edfc1bfb61b
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MASSEMBLY) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MASSEMBLY-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MASSEMBLY-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the integration tests successfully (`mvn -Prun-its clean verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] slawekjaranowski commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1119337498

   We can use `invoker.ordinal` for control run order
   https://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#invokerPropertiesFile


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on a diff in pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas commented on code in PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#discussion_r866097262


##########
src/main/java/org/apache/maven/plugins/assembly/archive/task/AddDependencySetsTask.java:
##########
@@ -183,7 +185,12 @@ void addDependencySet( final DependencySet dependencySet, final Archiver archive
 
     private ProjectBuildingRequest getProjectBuildingRequest( AssemblerConfigurationSource configSource )
     {
-        return configSource.getMavenSession().getProjectBuildingRequest();
+        MavenSession mavenSession = configSource.getMavenSession();
+        return new DefaultProjectBuildingRequest()
+                .setRepositorySession( mavenSession.getRepositorySession() )
+                .setSystemProperties( mavenSession.getSystemProperties() )
+                .setUserProperties( mavenSession.getUserProperties() )
+                .setProcessPlugins( false );
     }

Review Comment:
   Reusing it with copy-ctor, as setter of processPlugins modifies the existing instance.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: Do not download whole universe

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1115805828

   We  could even bolt on some existing IT, I did full IT suite build w/ and w/o this PR, here is what I got: These are states AFTER full IT suite ran successfully:
   
   Local repo by ITs 
   * had 4192 files (master) vs 3418 files (PR).
   * size was 106816 bytes (master) vs 85808 bytes (PR).
   * CONTAINS org.eclipse.tycho maven plugin (master) vs DOES NOT contain s it (PR)
   
   And I think we got our test as well: tycho. It is a build plugin (used by sisu among others), and for sure NONE of our IT projects depend on it.
   
   Full outputs for reference below.
   
   On master (without PR):
   ```
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ find target/local-repo/ -type f | wc -l
   4192
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ du target/local-repo/ -s
   106816	target/local-repo/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ ll target/local-repo/org/eclipse/
   total 20
   drwxrwxr-x  5 cstamas cstamas 4096 máj    3 09:11 ./
   drwxrwxr-x 24 cstamas cstamas 4096 máj    3 09:11 ../
   drwxrwxr-x  7 cstamas cstamas 4096 máj    3 09:06 aether/
   drwxrwxr-x  6 cstamas cstamas 4096 máj    3 09:06 sisu/
   drwxrwxr-x 18 cstamas cstamas 4096 máj    3 09:11 tycho/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ 
   ```
   
   On this PR:
   ```
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ find target/local-repo/ -type f | wc -l
   3418
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ du target/local-repo/ -s
   85808	target/local-repo/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ ll target/local-repo/org/eclipse/
   total 16
   drwxrwxr-x  4 cstamas cstamas 4096 máj    3 08:58 ./
   drwxrwxr-x 22 cstamas cstamas 4096 máj    3 09:02 ../
   drwxrwxr-x  7 cstamas cstamas 4096 máj    3 08:58 aether/
   drwxrwxr-x  6 cstamas cstamas 4096 máj    3 08:58 sisu/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: Do not download whole universe

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1115805829

   We  could even bolt on some existing IT, I did full IT suite build w/ and w/o this PR, here is what I got: These are states AFTER full IT suite ran successfully:
   
   Local repo by ITs 
   * had 4192 files (master) vs 3418 files (PR).
   * size was 106816 bytes (master) vs 85808 bytes (PR).
   * CONTAINS org.eclipse.tycho maven plugin (master) vs DOES NOT contain s it (PR)
   
   And I think we got our test as well: tycho. It is a build plugin (used by sisu among others), and for sure NONE of our IT projects depend on it.
   
   Full outputs for reference below.
   
   On master (without PR):
   ```
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ find target/local-repo/ -type f | wc -l
   4192
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ du target/local-repo/ -s
   106816	target/local-repo/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ ll target/local-repo/org/eclipse/
   total 20
   drwxrwxr-x  5 cstamas cstamas 4096 máj    3 09:11 ./
   drwxrwxr-x 24 cstamas cstamas 4096 máj    3 09:11 ../
   drwxrwxr-x  7 cstamas cstamas 4096 máj    3 09:06 aether/
   drwxrwxr-x  6 cstamas cstamas 4096 máj    3 09:06 sisu/
   drwxrwxr-x 18 cstamas cstamas 4096 máj    3 09:11 tycho/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (master)$ 
   ```
   
   On this PR:
   ```
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ find target/local-repo/ -type f | wc -l
   3418
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ du target/local-repo/ -s
   85808	target/local-repo/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ ll target/local-repo/org/eclipse/
   total 16
   drwxrwxr-x  4 cstamas cstamas 4096 máj    3 08:58 ./
   drwxrwxr-x 22 cstamas cstamas 4096 máj    3 09:02 ../
   drwxrwxr-x  7 cstamas cstamas 4096 máj    3 08:58 aether/
   drwxrwxr-x  6 cstamas cstamas 4096 máj    3 08:58 sisu/
   cstamas@Urnebes ~/Worx/apache-maven/maven-assembly-plugin  (do-not-download-whole-universe)$ 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas merged pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas merged PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: Do not download whole universe

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1112040243

   I assume it is: for example, we could create an IT that uses an OSGi bundle as dependency for assembly, then the IT could verify the the plugin used to build that JAR (bundle) is NOT downloaded (is not present in local repo) -- typical example of felix plugin that is present in "without PR" gist above...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1115822557

   @rfscholte added IT that FAILS on master, and PASSES OK on this branch
   See 3d2eadf871c82f7996ba46b54d4f481f49b7cc67


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1115836070

   Hm, not the best IT: as all IT share same local repo, it may end up in false positive somewhere in future (as current state is ok: fails on master, passes ok on branch), as if some future IT adds tycho dependency, this IT will fail (also, depending on run order).
   
   Best would be if this new IT would be able to use it's own dedicated local repo.... Any idea how to achieve that?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1118572926

   anyone else has anything to add here? Maybe some idea to improve added test? (as it is fragile, in a sense that if any other IT would use "banned" dependency AND it would execute before this IT, it would produce false positive.... 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] rfscholte commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
rfscholte commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1115868232

   IIRC this plugin uses the mock repository manager, so it should be easy to define dependencies there. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] cstamas commented on pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1119366730

   Pushed 2 more commits:
   * 1st commit: reverted to UT AddDependencySetsTaskTest.java from master and applied the single change this PR needs (mockito arg matcher: we do not pass anymore _same_ instance to builder, but a new instance we create with copy ctor)
   * 2nd commit: removed unused mocked calls, as reported by IDE (maven does not reports these, is just extra baggage, so cleans them up)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] gnodet commented on a diff in pull request #55: [MASSEMBLY-956] Resolve only what is needed for final assembly

Posted by GitBox <gi...@apache.org>.
gnodet commented on code in PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#discussion_r866052752


##########
src/main/java/org/apache/maven/plugins/assembly/archive/task/AddDependencySetsTask.java:
##########
@@ -183,7 +185,12 @@ void addDependencySet( final DependencySet dependencySet, final Archiver archive
 
     private ProjectBuildingRequest getProjectBuildingRequest( AssemblerConfigurationSource configSource )
     {
-        return configSource.getMavenSession().getProjectBuildingRequest();
+        MavenSession mavenSession = configSource.getMavenSession();
+        return new DefaultProjectBuildingRequest()
+                .setRepositorySession( mavenSession.getRepositorySession() )
+                .setSystemProperties( mavenSession.getSystemProperties() )
+                .setUserProperties( mavenSession.getUserProperties() )
+                .setProcessPlugins( false );
     }

Review Comment:
   Why not reusing the existing `ProjectBuildingRequest` ? What does that actually change ?
   Shouldn't that be something like:
   ```
   return  new DefaultProjectBuildingRequest( configSource.getMavenSession().getProjectBuildingRequest() )
         .setProcessPlugins( false );
   ```
   I fear not reusing the existing will loose remote repositories and other settings, not sure though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-assembly-plugin] rfscholte commented on pull request #55: Do not download whole universe

Posted by GitBox <gi...@apache.org>.
rfscholte commented on PR #55:
URL: https://github.com/apache/maven-assembly-plugin/pull/55#issuecomment-1112023273

   is it possible to add a verification that a certain dependency is not being downloaded?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org