[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [m2e-users] m2e-wtp, war overlays and shared resources | 
Hi,
> Can you link to a sample project reproducing the issue?
Sorry for the late reply; I didn't manage to come
back earlier...
Anyway, I've attached a simple project with which
you can reproduce the behaviour: When you import the main module in Eclipse,
the Jar module has to be converted manually to a faceted project and marked
as being a utility module.
When configured correctly and you start the EAR inside
Wildfly for example, enter "http://localhost:8080/foo"
in your browser and you see a simple HTML page saying "Hello World".
Regards
Thorsten
> 
> On Thu, Aug 10, 2017 at 8:55 AM, Thorsten Heit <thorsten.heit@xxxxxx>
wrote:
> Hi, 
> 
> once again I'm having troubles with shared resources I'm using in
a WAR 
> project. The basic structure is: 
> 
> - mvn-p1-resources 
> ... 
> - mvn-pn-resources 
> - app-main 
>   +- app-jar 
>   +- app-war 
>      +- app-jar 
>      +- mvn-p1-resourcse 
>      +- ... 
>      \- mvn-pn-resources 
>   +- app-ear 
> 
> 
> The projects mvn-p*-resources use packaging type "jar" and
contain 
> resource files such as HTML files, CSS, XSL,_javascript_s etc., and
are 
> added as provided dependencies in the WAR project. The WAR module
ifself 
> uses overlays to package them into the correct place inside the generated
> WAR; see below in the mail I'm replying to how I'm actually doing
this. 
> 
> Building the EAR from the command line works; everything is in the
> correct place as expected. When I add the EAR in Eclipse to a server
such
> as Wildfly the application doesn't start correctly because of missing
> resources. So far I've tracked down the issues to the following behaviour:
> 
> - Delete mvn-p1...n-resources from my workspace 
> - Re-Checkout the project from Subversion 
> - Open the WAR project's properties dialog, have a look into the 
> deployment assembly dialog page 
> - For all deleted and re-added projects mvn-pX-resources the dialog
page 
> shows a warning message 
>   "Cannot find entry: "mvn-pX-resources" 
> 
> Right-clicking on the projects and executing Maven->Update Project...
> doesn't have any effect; the warning messages remain, and the application
> doesn't start correctly. 
> 
> I can manually fix this by right-clicking on mvn-pX-resources, execute
> Configure -> Convert to Faceted Form... and select the checkbox
by 
> "Utility Module" in the dialog. This is puzzling me because
according to 
> the docs ([1]) m2e-wtp has support for jar dependency projects and
should
> add the Java and Utility Facets to them. 
> 
> At least for "normal" jar module dependencies (i.e. dependencies
that 
> contain Java code) this works as expected. I can only imagine that
m2e-
> wtp (?) treats provided dependencies different than direct or transitive
> used ones...? 
> 
> Any hints what is causing this behaviour? 
> 
> 
> 
> 
> - Eclipse Oxygen (20170620-1800) 
> - m2e 1.8.1.20170728-1531 
> - m2e-wtp 1.3.2.20170517-2015 
>   together with the m2e-wtp JAX-RS, JPA and JSF configurators
for WTP 
> (same version) 
> - Oracle JDK 8u141 
> - Windows 8.1 x64 
> 
> 
> [1] https://wiki.eclipse.org/M2E-WTP
> 
> 
> Regards 
> 
> Thorsten 
> 
> 
> 
> 
> 
> > Von: "Thorsten Heit" <thorsten.heit@xxxxxx> 
> > An: Maven Integration for Eclipse users mailing list <m2e-users@xxxxxxxxxxx>
> > Datum: 18.04.2017 15:37 
> > Betreff: Re: [m2e-users] m2e-wtp, war overlays and shared resources
> > Gesendet von: m2e-users-bounces@xxxxxxxxxxx 
> > 
> > Hi, 
> > 
> > referencing an older thread of mine... 
> > 
> > I'm having problems with m2e-wtp on a multi-module project that
produces 
> > a few EARs with WARs that use overlays: Deploying such a WAR
on Tomcat 8.
> > 5.x or the corresponding EAR to Wildfly 10.1 is unsuccessful,
the 
> > application doesn't start correctly because of missing resources
in the 
> > WAR's WEB-INF folder. 
> > 
> > Basic structure of my project: 
> > 
> > app-main 
> > +- app-form-resources 
> > +- app-xsl-resources 
> > +- app-jar 
> >    +- mvn-p1 
> >    +- mvn-p2 
> >    +- ... 
> >    \- mvn-pn 
> > +- app-war 
> >    +- app-jar 
> >    +- mvn-p1-resources 
> >    +- mvn-p2-resources 
> >    +- ... 
> >    \- mvn-pn-resources 
> > +- app-ear 
> >    \- app-war 
> > 
> > The other mentioned WARs and EARs are basically the same as app-war/app-
> > ear, but with a few customized files under WEB-INF. Anyway. 
> > 
> > P1...n are legacy projects in our Subversion repository containing
both 
> > Java sources and resource files (_javascript_, HTML, XML, XSL etc.)
and are
> > used in other applications built in our department. So far I
have created
> > a Maven-compatible "layer" for each of these projects
and factored out 
> > Java files and resources: 
> > * mvn-pX contains only the Java sources from project X (under
src/main/java) 
> > * mvn-pX-resources contains the legacy project's resources (directly
> > under src/main/resources) 
> > 
> > The same holds for app-form-resources and app-xsl-resources:
two projects
> > that contain resources from the legacy project for which I'm
building the
> > Maven layer. 
> > 
> > All resource projects are of type "jar" and used as
dependency with scope
> > "provided" in app-war: 
> > 
> > <dependency> 
> >         <groupId>mygroup</groupId>
> >         <artifactId>mvn-p1-resources</artifactId>
> >         <version>...</version>
> >         <scope>provided</scope>
> > </dependency> 
> > 
> > To put the resources in the correct place I'm using overlays:
> > 
> > <plugin> 
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-war-plugin</artifactId>
> >         <version>3.0.0</version>
> >         <configuration> 
> >                 <filteringDeploymentDescriptors>true</
> > filteringDeploymentDescriptors> 
> > 
> >                 <overlays>
> >                  
      <overlay> 
> >                  
              <groupId>${project.groupId}</groupId>
> >                  
              <artifactId>app-xsl-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/WEB-INF/xsl</targetPath>
> >                  
      </overlay> 
> >                  
      <overlay> 
> >                  
              <groupId>${project.groupId}</groupId>
> >                  
              <artifactId>app-form-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/form</targetPath>
> >                  
      </overlay> 
> > 
> >                  
      <overlay> 
> >                  
              <groupId>group1</groupId>
> >                  
              <artifactId>mvn-p1-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/</targetPath>
> >                  
              <includes> 
> >                  
                     
<include>**/*.css</include> 
> >                  
                     
<include>**/*.js</include> 
> >                  
              </includes> 
> >                  
      </overlay> 
> >                  
      <overlay> 
> >                  
              <groupId>group1</groupId>
> >                  
              <artifactId>mvn-p1-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/WEB-INF</targetPath>
> >                  
              <includes> 
> >                  
                     
<include>**/*.x*</include> 
> >                  
                     
<include>**/*.js</include> 
> >                  
              </includes> 
> >                  
      </overlay> 
> > 
> >                  
      <overlay> 
> >                  
              <groupId>group2</groupId>
> >                  
              <artifactId>mvn-p2-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/form</targetPath>
> >                  
              <includes> 
> >                  
                     
<include>**/*.css</include> 
> >                  
                     
<include>**/*.js</include> 
> >                  
              </includes> 
> >                  
      </overlay> 
> > 
> >                  
      <overlay> 
> >                  
              <groupId>group3</groupId>
> >                  
              <artifactId>mvn-p3-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/form</targetPath>
> >                  
              <includes> 
> >                  
                     
<include>**/*.js</include> 
> >                  
              </includes> 
> >                  
      </overlay> 
> >                  
      <overlay> 
> >                  
              <groupId>group3</groupId>
> >                  
              <artifactId>mvn-p3-resources</artifactId>
> >                  
              <type>jar</type>
> >                  
              <targetPath>/WEB-INF/xsl</targetPath>
> >                  
              <excludes> 
> >                  
                     
<exclude>**/*.js</exclude> 
> >                  
                     
<exclude>META-INF/**</exclude> 
> >                  
              </excludes> 
> >                  
      </overlay> 
> > 
> >                  
      ... 
> >                 </overlays>
> >         </configuration> 
> > </plugin> 
> > 
> > 
> > My problem is that the EAR builds successfully on the command
line and 
> > contains all specified resources in their correct place, but
with WTP / 
> > m2e-wtp problems arise: 
> > 
> > * Deploying app-war to Tomcat or app-ear to Wildfly doesn't work;
the 
> > resources from app-form-resources, app-xsl-resources and mvn-p1...3-
> > resources are completely missing 
> > * When I right-click in the package explorer view on app-war
and open the
> > properties, I see a few warnings in the deployment assembly dialog
page: 
> >   Cannot find entry: app-form-resources 
> >   The same warning entry for app-xsl-resources and mvn-p1...3-resources
> >   Other referenced (resource) projects are correctly listed
without 
> > errors/warnings. 
> > * Starting app-ear in Wildfly and having a look in the folder
<wildfly-
> > home>/standalone/deployments you can see that all other resource
projects
> > are correctly contained/deployed. 
> > 
> > All resource projects have the same structure and basically differ
only 
> > in their GAV coordinates and referenced resource files. 
> > Changing the order of the overlay entries doesn't make any difference,
> by the way.
> > 
> > 
> > Do you have any idea what can cause this strange behaviour? 
> > 
> > 
> > Regards 
> > 
> > Thorsten 
> > 
> > 
> > 
> > m2e-users-bounces@xxxxxxxxxxx schrieb am 26.02.2015 19:14:47:
> > 
> > > Von: Fred Bricon <fbricon@xxxxxxxxx> 
> > > An: Maven Integration for Eclipse users mailing list <m2e-users@xxxxxxxxxxx>
> > > Datum: 26.02.2015 19:15 
> > > Betreff: Re: [m2e-users] m2e-wtp, war overlays and shared
resources 
> > > Gesendet von: m2e-users-bounces@xxxxxxxxxxx 
> > > 
> > > m2e-wtp currently doesn't support artifacts generated by
maven-assembly-
> > > plugin within the workspace. i.e a workspace project cannot
reference a 
> > > zip classifier artifact matching another workspace project.
 
> > > 
> > > You basically have 2 solutions :  
> > > - force the consumers to reference the zip file directly
: either disable
> > > workspace resolution for projects consuming your zip (project
> maven > 
> > > disable worskpace resolution)  or delete mvn-Q-resources
from your 
> > > workspace. The big drawback of that approach is you'll have
to execute 
> > > mvn install on mvn-Q-resources everytime a file changes
> > > - change mvn-Q-resources type to jar. Move all your web
resources to src/
> > > main/resources and reference : 
> > > 
> > >        <overlay> 
> > >           <groupId>mygroup</groupId>
> > >           <artifactId>mvn-Q-resources</artifactId>
> > >           <type>jar</type>
> > >           <targetPath>/WEB-INF</targetPath>
> > >           <includes> 
> > >             <include>/xsl/**</include>
> > >           </includes> 
> > >         </overlay>  
> > > 
> > > That solution should allow you to keep working/deploying
stuff incrementally 
> > > 
> > > On Thu, Feb 26, 2015 at 11:25 AM, Thorsten Heit <thorsten.heit@xxxxxx>
wrote: 
> > > Hi, 
> > > 
> > > I'm in the process of creating Maven builds for a few applications.
These
> > > applications use Ant build scripts to create WAR and EAR
files. 
> > > 
> > > 
> > > Initial situation: 
> > > 
> > > * All source code is stored in our Subversion repository.
> > > * Each application depends on several internal projects
P1, P2, ... that 
> > > all have a non-Maven-like structure. 
> > > * Most, but not all of them not only contain Java code,
but also web 
> > > resources (HTML, _javascript_, XSL, ...) that have to be placed
directly 
> > > under "/" or under "/WEB-INF" in the
resulting application WAR(s). 
> > > 
> > > 
> > > 
> > > Actual situation: 
> > > 
> > > * For each internal project P that contains only Java code
I have created
> > > a new Maven project mvn-P using Maven conventions and directory
layout; 
> > > Java code is referenced under src/main/java via svn:externals.
> > > * For each project Q that contains both Java sources and
resource files, 
> > > I have created two Maven projects mvn-Q and mvn-Q-resources;
as above 
> > > Java code and resources are referenced via svn:externals.
The mvn-Q-
> > > resources project is of type pom and uses the assembly plugin
to create a
> > > zip archive containing the resources; i.e. builds an artifact
named mvn-
> > > Q-resources-<version>-zip.zip 
> > > 
> > > 
> > > For one of the WAR and EAR projects I created a multi-module
Maven 
> > > project to build the same WAR and EAR via Maven as the legacy
Ant script.
> > > The structure is basically the following: 
> > > 
> > > app-main 
> > > +- app-jar 
> > >    +- mvn-p 
> > >    \- mvn-q 
> > > +- app-war 
> > >    +- app-jar 
> > >    \- mvn-q-resources 
> > > +- app-ear 
> > >    \- app-war 
> > > 
> > > 
> > > The app-war pom.xml contains the following: 
> > > 
> > > <plugins> 
> > >   <plugin> 
> > >     <groupId>org.apache.maven.plugins</groupId>
> > >     <artifactId>maven-war-plugin</artifactId>
> > >     <configuration> 
> > >       <!-- web resources --> 
> > >       <overlays> 
> > >         <overlay> 
> > >           <groupId>mygroup</groupId>
> > >           <artifactId>mvn-Q-resources</artifactId>
> > >           <type>zip</type>
> > >           <classifier>zip</classifier>
> > >           <targetPath>/WEB-INF</targetPath>
> > >           <includes> 
> > >             <include>/xsl/**</include>
> > >           </includes> 
> > >         </overlay> 
> > >         ... 
> > >       </overlays> 
> > >     </configuration> 
> > >   </plugin> 
> > >   ... 
> > > </plugins> 
> > > 
> > > <dependencies> 
> > >   <dependency> 
> > >     <groupId>mygroup</groupId> 
> > >     <artifactId>mvn-Q-resources</artifactId>
> > >     <version>1.0-SNAPSHOT</version>
> > >     <type>zip</type> 
> > >     <classifier>zip</classifier> 
> > >     <scope>runtime</scope> 
> > >   </dependency> 
> > >   ... 
> > > </dependencies> 
> > > 
> > > So far, this works pretty fine using command-line Maven.
> > > 
> > > 
> > > 
> > > The problem: 
> > > 
> > > My Eclipse workspace contains all necessary projects, i.e.
mvn-P, mvn-Q, 
> > > mvn-Q-resources, app-main, app-jar, app-war and app-ear.
In the server 
> > > view I created a new instance using a locally installed
Tomcat. After 
> > > adding app-war to it I see all the project's jar dependencies
in the 
> view. But: 
> > > Although I can start the server and debug in the referenced
dependencies,
> > > the WAR application doesn't run correctly because the referenced
> > > resources are not available, i.e. everything I added to
m-war-p via 
> > > overlays/overlay. 
> > > 
> > > I'm using the following: 
> > > 
> > > * Eclipse Mars 4.5 (Build id: I20150203-1300) 
> > > * Java EE Developer Tools 3.7.0.v201501282120 
> > > * m2e 1.6.0.20150220-1952 
> > > * m2e-wtp 1.2.0.20150212-1712 
> > > * Tomcat v8.0.20 
> > > * Java 7u76 
> > > 
> > > Do you have any hints on how to solve this? 
> > > Do I need to change something? 
> > > Is m-assembly-p the right way to create an archive containing
resources 
> > > that are shared between other applications? 
> > > 
> > > 
> > > 
> > > Regards 
> > > 
> > > Thorsten
> > > _______________________________________________
> > > m2e-users mailing list
> > > m2e-users@xxxxxxxxxxx
> > > To change your delivery options, retrieve your password,
or unsubscribe 
> > > from this list, visit
> > > 
> https://dev.eclipse.org/mailman/listinfo/m2e-users
> > > 
> > 
> > > 
> > > -- 
> > > "Have you tried turning it off and on again" -
The IT Crowd
> > > _______________________________________________
> > > m2e-users mailing list
> > > m2e-users@xxxxxxxxxxx
> > > To change your delivery options, retrieve your password,
or unsubscribe 
> > > from this list, visit
> > > 
> https://dev.eclipse.org/mailman/listinfo/m2e-users
> 
> > _______________________________________________
> > m2e-users mailing list
> > m2e-users@xxxxxxxxxxx
> > To change your delivery options, retrieve your password, or unsubscribe
> > from this list, visit
> > https://dev.eclipse.org/mailman/listinfo/m2e-users
> 
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/m2e-users
> 
> 
> -- 
> "Have you tried turning it off and on again"
- The IT Crowd
> And if that fails, then http://goo.gl/tnBgH5
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/m2e-usersAttachment:
foo.tar.bz2
Description: Binary data