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

Improve support for skinny war files

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.7
    • Labels:
      None
    • Environment:
      mvn 2.0.5
    • Number of attachments :
      3

      Description

      Provide a boolean configuration option for webModules to include the war's transitive dependencies.

      As described on http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html it is very common in a J2EE environment to use so called skinny wars. Here the war's WEB-INF/lib will not contain the dependent jars, but instead they are packaged inside the EAR. The war references them through its META-INF/MANIFEST.MF

      This option could be used to avoid the 'painful part' mentioned in the above web page. The war's dependencies wouldn't have to be duplicated alongside the ear's.

      I also found an old issue (MEAR-14) which has asked for the current default behavior of not including the transitive dependencies. It suggests a property to include specific dependencies of the war. As far as I can tell this has never been implemented and this is also not what I am asking for. My proposal is an all of nothing kind of option for each war module in the ear.

      On a side note, for me this is the part where removal of the old maven 1 style properties per dependency is missed the most. With them it was possible to decide for each single dependency whether to put it in WEB-INF/lib or reference it through the manifest classpath. But of course, then we didn't have the transitive dependencies

        Issue Links

          Activity

          Hide
          Dennis Lundberg added a comment -

          Hi Andreas,

          I've done some more testing and have come to the following conclusions:

          • When you "mvn install" something into the local repo it will always be a -SNAPSHOT version
          • When you "mvn deploy" something it will depend on the settings of the repo and which version of Maven you use. Maven 3 will always deploy a timestamped version in the remote repo
          • I haven't been able to successfully remove a timestamped version from a WAR using your custom fileNameMapper. When I run my test project version and baseVersion are always the same

          It seems to me that it is the WAR plugin that is at fault here. It should IMO not include timestamped versions of JARs inside a WAR.

          Show
          Dennis Lundberg added a comment - Hi Andreas, I've done some more testing and have come to the following conclusions: When you "mvn install" something into the local repo it will always be a -SNAPSHOT version When you "mvn deploy" something it will depend on the settings of the repo and which version of Maven you use. Maven 3 will always deploy a timestamped version in the remote repo I haven't been able to successfully remove a timestamped version from a WAR using your custom fileNameMapper. When I run my test project version and baseVersion are always the same It seems to me that it is the WAR plugin that is at fault here. It should IMO not include timestamped versions of JARs inside a WAR.
          Hide
          Dennis Lundberg added a comment -

          I'm closing this issue as fixed now.

          Andreas, if you manage to put together a reproducible example project for the versioning issue, please open a new issue for that. If we get a release out we can get more people to test this in the wild, and perhaps they can help us zoom in on the that issue.

          Show
          Dennis Lundberg added a comment - I'm closing this issue as fixed now. Andreas, if you manage to put together a reproducible example project for the versioning issue, please open a new issue for that. If we get a release out we can get more people to test this in the wild, and perhaps they can help us zoom in on the that issue.
          Hide
          Andreas Thaler added a comment -

          Hi Dennis,

          Purpose of my fileNameMapper was not to remove the timestamped version from war, instead it configured the ear to use timestamped versions for the shared libs.
          Nevertheless I changed my code now by configuring the war plugin to use non-timestamped versions and now it works fine. I always avoided this approach as I have many war projects to configure contra one ear project, but it is ok.

          thanks for your support, am looking forward to the new release

          Show
          Andreas Thaler added a comment - Hi Dennis, Purpose of my fileNameMapper was not to remove the timestamped version from war, instead it configured the ear to use timestamped versions for the shared libs. Nevertheless I changed my code now by configuring the war plugin to use non-timestamped versions and now it works fine. I always avoided this approach as I have many war projects to configure contra one ear project, but it is ok. thanks for your support, am looking forward to the new release
          Hide
          Connor Barry added a comment -

          Hi Andreas, I'm a little new to Maven internals but experiencing this exact problem as well. How did you configure your war plugin to use the non-timestamped version of the jar dependencies? I feel like that is a little cleaner than keeping the timestamp versions around in the EAR's APP-INF/lib folder.

          Show
          Connor Barry added a comment - Hi Andreas, I'm a little new to Maven internals but experiencing this exact problem as well. How did you configure your war plugin to use the non-timestamped version of the jar dependencies? I feel like that is a little cleaner than keeping the timestamp versions around in the EAR's APP-INF/lib folder.
          Hide
          Andreas Thaler added a comment -

          I configured the outputFileNameMapping for the war-plugin like that:

          <plugin>
          	<groupId>org.apache.maven.plugins</groupId>
          	<artifactId>maven-war-plugin</artifactId>
          	<version>2.1.1</version>
          	<configuration>
          		<!-- use baseVersion instead of unique timestamp version to support skinny WARS -->
          		<outputFileNameMapping>@{artifactId}@-@{baseVersion}@.@{extension}@</outputFileNameMapping>
          	</configuration>
          </plugin>
          
          Show
          Andreas Thaler added a comment - I configured the outputFileNameMapping for the war-plugin like that: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <!-- use baseVersion instead of unique timestamp version to support skinny WARS --> <outputFileNameMapping>@{artifactId}@-@{baseVersion}@.@{extension}@</outputFileNameMapping> </configuration> </plugin>

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Marcel Schutte
            • Votes:
              50 Vote for this issue
              Watchers:
              40 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: