ShrinkWrap
  1. ShrinkWrap
  2. SHRINKWRAP-325

ShrinkWrap.create(MavenImporter.class) that creates a WebArchive that adds all WEB-INF descriptors, classes, test classes and webapp resources too (not just dependencies and test dependencies)

    Details

    • Type: Feature Request Feature Request
    • Status: Closed (View Workflow)
    • Priority: Critical Critical
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: resolver-1.1.0-alpha-1
    • Component/s: None
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

      The MavenDependencyResolver is nice, but it does only half the job.
      We still have to manually add "target/guvnor-webapp-5.3.0-SNAPSHOT/"
      or "target/classes" and "target/test-classes" and "src/webapp/WEB-INF/*" files etc.

      But all that info is in the pom model, so it would be nice to have a feature as a facade for that.
      Something like

      ShrinkWrap.createEntirelyFromMavenPom("pom.xml", includeEntireTestClasspath).
      

      Note that it can include the entire test classpath (for helper classes under "target/test-classes" and dependencies such as Mockito).

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Geoffrey De Smet added a comment - - edited

            @Marek: I am ok with adding finer-grained methods (in a separate issue?), so people can control to "only import the build output",
            but the 1 course-grained facade method should still be there.

            Most users, just want it "to just work", without having to fine tune all knobs and buttons. I 've wasted much time trial and erroring on all those knobs and buttons.
            And in 80% of the cases, "to just work" means deploying the maven generated war with the test classpath added.
            Yet, Marak's extra methods are useful for those 20% use cases where you need to do sometimes special.
            General idea: configuration by exception.

            Show
            Geoffrey De Smet added a comment - - edited @Marek: I am ok with adding finer-grained methods (in a separate issue?), so people can control to "only import the build output", but the 1 course-grained facade method should still be there. Most users, just want it "to just work", without having to fine tune all knobs and buttons. I 've wasted much time trial and erroring on all those knobs and buttons. And in 80% of the cases, "to just work" means deploying the maven generated war with the test classpath added. Yet, Marak's extra methods are useful for those 20% use cases where you need to do sometimes special. General idea: configuration by exception.
            Hide
            Karel Piwko added a comment -

            Initial implementation at https://github.com/kpiwko/resolver/tree/SHRINKWRAP-325 (only jar packaging supported atm, javadoc will follow

            Current usage looks like:

            JavaArchive archive = ShrinkWrap.create(MavenImporter.class).loadEffectivePom("pom.xml").importBuildOutput()
                            .importTestBuildOutput().as(JavaArchive.class);       
             
                    Assert.assertNotNull("Archive is not null", archive);
                    Assert.assertTrue("Archive contains jar class", archive.contains("test/JarClass.class"));
                    Assert.assertTrue("Archive contains jar test class", archive.contains("test/JarTestCase.class"));
            

            Show
            Karel Piwko added a comment - Initial implementation at https://github.com/kpiwko/resolver/tree/SHRINKWRAP-325 (only jar packaging supported atm, javadoc will follow Current usage looks like: JavaArchive archive = ShrinkWrap.create(MavenImporter.class).loadEffectivePom("pom.xml").importBuildOutput() .importTestBuildOutput().as(JavaArchive.class);   Assert.assertNotNull("Archive is not null", archive); Assert.assertTrue("Archive contains jar class", archive.contains("test/JarClass.class")); Assert.assertTrue("Archive contains jar test class", archive.contains("test/JarTestCase.class"));
            Hide
            Geoffrey De Smet added a comment -

            @kpiwko Looks good. When it's merged to blessed master, I 'll build the snapshot locally and try it out.

            Show
            Geoffrey De Smet added a comment - @kpiwko Looks good. When it's merged to blessed master, I 'll build the snapshot locally and try it out.
            Hide
            Karel Piwko added a comment -

            Full support available at https://github.com/kpiwko/resolver/commit/20957339e2976047bc4d4281dae21ce84996cc17. Please try to build and comment, I'd like to merge to master soon as this modification forced some internal changes (mainly different dependency equality check).

            Just a note, this importer requires tests to run in integration-test phase.

            Show
            Karel Piwko added a comment - Full support available at https://github.com/kpiwko/resolver/commit/20957339e2976047bc4d4281dae21ce84996cc17 . Please try to build and comment, I'd like to merge to master soon as this modification forced some internal changes (mainly different dependency equality check). Just a note, this importer requires tests to run in integration-test phase.
            Show
            Andrew Rubinger added a comment - Upstream: https://github.com/shrinkwrap/resolver/commit/345b03fd28b4ffc061f6f25639ca57f82ee5b774

              People

              • Assignee:
                Karel Piwko
                Reporter:
                Geoffrey De Smet
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development