Maven Ear Plugin
  1. Maven Ear Plugin
  2. MEAR-85

ejb-client dependencies should be placed in defaultLibBundleDir

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.4.1
    • Labels:
      None
    • Number of attachments :
      2

      Description

      ejb-client jars should be placed in the defaultLibBundleDir when specified. They're just standard jar dependencies not J2EE artifacts so should be treated the same as other jars. They're currently being placed in the root directory.

      A workaround is to add an ejbClientModule entry to override the bundleDir:

      <modules>
      <ejbClientModule>
      <groupId>...</groupId>
      <artifactId>...</artifactId>
      <bundleDir>lib</bundleDir>
      </ejbClientModule>
      </modules>

      1. MEAR-85-ashipilev-TESTS.patch
        17 kB
        Aleksey Shipilev
      2. MEAR-85-ashipilev-v1.patch
        2 kB
        Aleksey Shipilev

        Activity

        Hide
        Aleksey Shipilev added a comment - - edited

        Is this better? I assume this does not break 1.3/1.4 behaviour but fixes 5/6:

        Index: src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
        ===================================================================
        --- src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java	(revision 896892)
        +++ src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java	(working copy)
        @@ -60,7 +60,7 @@
              * @return an ear module for this artifact
              * @throws UnknownArtifactTypeException if the artifact is not handled
              */
        -    public static EarModule newEarModule( Artifact artifact, String defaultLibBundleDir,
        +    public static EarModule newEarModule( Artifact artifact, String version, String defaultLibBundleDir,
                                                   Boolean includeInApplicationXml )
                 throws UnknownArtifactTypeException
             {
        @@ -85,7 +85,12 @@
                 }
                 else if ( "ejb-client".equals( artifactType ) )
                 {
        -            return new EjbClientModule( artifact, null );
        +            // Somewhat weird way to tackle the problem described in MEAR-85
        +            if (AbstractEarMojo.VERSION_1_3.equals(version) || AbstractEarMojo.VERSION_1_4.equals(version)) {
        +                return new EjbClientModule( artifact, null ); 	
        +            } else {
        +                return new EjbClientModule( artifact, defaultLibBundleDir );
        +            }
                 }
                 else if ( "rar".equals( artifactType ) )
                 {
        Index: src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
        ===================================================================
        --- src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java	(revision 896892)
        +++ src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java	(working copy)
        @@ -223,7 +223,7 @@
                         if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional() &&
                             filter.include( artifact ) )
                         {
        -                    EarModule module = EarModuleFactory.newEarModule( artifact, defaultLibBundleDir,
        +                    EarModule module = EarModuleFactory.newEarModule( artifact, version, defaultLibBundleDir,
                                                                               includeLibInApplicationXml );
                             allModules.add( module );
                         }
        
        Show
        Aleksey Shipilev added a comment - - edited Is this better? I assume this does not break 1.3/1.4 behaviour but fixes 5/6: Index: src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java =================================================================== --- src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java (revision 896892) +++ src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java (working copy) @@ -60,7 +60,7 @@ * @ return an ear module for this artifact * @ throws UnknownArtifactTypeException if the artifact is not handled */ - public static EarModule newEarModule( Artifact artifact, String defaultLibBundleDir, + public static EarModule newEarModule( Artifact artifact, String version, String defaultLibBundleDir, Boolean includeInApplicationXml ) throws UnknownArtifactTypeException { @@ -85,7 +85,12 @@ } else if ( "ejb-client" .equals( artifactType ) ) { - return new EjbClientModule( artifact, null ); + // Somewhat weird way to tackle the problem described in MEAR-85 + if (AbstractEarMojo.VERSION_1_3.equals(version) || AbstractEarMojo.VERSION_1_4.equals(version)) { + return new EjbClientModule( artifact, null ); + } else { + return new EjbClientModule( artifact, defaultLibBundleDir ); + } } else if ( "rar" .equals( artifactType ) ) { Index: src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (revision 896892) +++ src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (working copy) @@ -223,7 +223,7 @@ if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional() && filter.include( artifact ) ) { - EarModule module = EarModuleFactory.newEarModule( artifact, defaultLibBundleDir, + EarModule module = EarModuleFactory.newEarModule( artifact, version, defaultLibBundleDir, includeLibInApplicationXml ); allModules.add( module ); }
        Hide
        Aleksey Shipilev added a comment -

        MEAR-85-ashipilev-TESTS.patch
        Integration tests for this issue.
        Breaks without the patch.

        Show
        Aleksey Shipilev added a comment - MEAR-85 -ashipilev-TESTS.patch Integration tests for this issue. Breaks without the patch.
        Hide
        Aleksey Shipilev added a comment -

        MEAR-85-ashipilev-v1.patch
        Proposed solution, fixes new integration tests.

        Show
        Aleksey Shipilev added a comment - MEAR-85 -ashipilev-v1.patch Proposed solution, fixes new integration tests.
        Hide
        Stéphane Nicoll added a comment - - edited

        okay, due to the number of votes and since we seems to have a working solution that fit, I'll review and apply the patches in the upcoming version.

        Show
        Stéphane Nicoll added a comment - - edited okay, due to the number of votes and since we seems to have a working solution that fit, I'll review and apply the patches in the upcoming version.
        Hide
        Stéphane Nicoll added a comment -

        Patch applied, thanks. A new snapshot of the upcoming 2.4.1 is also available.

        Show
        Stéphane Nicoll added a comment - Patch applied, thanks. A new snapshot of the upcoming 2.4.1 is also available.

          People

          • Assignee:
            Stéphane Nicoll
            Reporter:
            James Olsen
          • Votes:
            9 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: