-
1. Re: Maven - WEB-INF/lib libraries
snjeza Feb 7, 2010 4:47 PM (in response to germanescobar)Those libraries are created by Maven/m2eclipse when calling "mvn package" or "mvn install".
You can create a bug on https://issues.sonatype.org/browse/MNGECLIPSE
-
2. Re: Maven - WEB-INF/lib libraries
germanescobar Feb 8, 2010 3:42 PM (in response to snjeza)The problem here is that Maven WAR plugin configuration points warSourceDirectory and webappDirectory to the same folder, which is ${basedir}/WebContent. This presents some problems as the webappDirectory is the folder in which the generated warSourceDirectory is going to be placed:
- This means that the libraries that are downloaded to the webappDirectory will be in the same warSourceDirectory (my initial problem).
- If I want to do some resource filtering, it will fail as the generated webappDirectory is the same warSourceDirectory.
-
3. Re: Maven - WEB-INF/lib libraries
snjeza Feb 9, 2010 4:12 PM (in response to germanescobar)You are right.
I have created https://jira.jboss.org/jira/browse/JBIDE-5819
As a workaround, you can remove the webappDirectory element from the pom.xml file.
Thanks for solving this issue!
-
4. Re: Maven - WEB-INF/lib libraries
germanescobar Feb 10, 2010 4:10 PM (in response to snjeza)I removed the webappDirectory element from the POM. However, the problem now is that I've lost hot deployment. When I change a file from my webapp, it says "Publishing to JBoss ... " as usual, but nothing gets really published. The EAR inside the JBoss deploy folder remains the same.
What I'm doing now as a workaround is to run "mvn package" from the m2eclipse menu ... then it gets published.
-
5. Re: Maven - WEB-INF/lib libraries
snjeza Feb 10, 2010 6:18 PM (in response to germanescobar)You mean - hot deployment works if you add webappDirectory, but doesn't work if you remove it?
What JBoss AS are you using?
-
6. Re: Maven - WEB-INF/lib libraries
germanescobar Feb 10, 2010 7:02 PM (in response to snjeza)I'm using JBoss 4.2.3.GA. Sorry, I missed something on my last post. As I removed the webappDirectory element from the POM, all the WebContent structure is being "replicated" to the folder "target/myproject-1.0.0-SNAPSHOT". So, I had to change the WTP assembly to point to that folder instead of WebContent. Why? Well, multiple reasons:
- I use Maven's resource filtering on some descriptors (i.e. web.xml and jboss-web.xml).
- The WebContent/WEB-INF/lib/ doesn't have the libraries anymore (which is a good thing).
- The "target/myproject-1.0.0-SNAPSHOT" folder has the libraries and the resources after being filtered.
So far so good. Now, when I change a file from WebContent (i.e. home.xhtml), it is not copied to the "target/myproject-1.0.0-SNAPSHOT" folder. The "Publishing to JBoss .." messages appears but as the file hasn't change in "target/..." folder, there is nothing to copy to the JBoss deploy directory. So, I see no changes in my app.
Once I run "mvn package", the "Publishing to JBoss ..." message appears again but this time it is published correctly to the JBoss deploy folder (now it has change in the "target/..." folder!).
Hope it makes more sense.
BTW, as the WebContent folder is "replicated", when I want to look for a resource, it appears duplicated; one for the WebContent folder and the other for the "target/myproject-1.0.0-SNAPSHOT" folder.
-
7. Re: Maven - WEB-INF/lib libraries
liriarte Mar 1, 2011 4:25 PM (in response to germanescobar)Hi German,
I think I am in the a similar situation than you one year later. My app runs OK if I keep the /lib/ folder with all the jars in the WAR project. I tried changing the assembly like you and now I have another error. I was wondering how did you handle the assembly for the EAR project. Did you change it as well?
Did you use maven from the console or always with the plugin?
Thanks, Leandro
-
8. Re: Maven - WEB-INF/lib libraries
dlmiles Mar 19, 2011 1:03 AM (in response to germanescobar)With regards to webappDirectory the default project layout with Maven for a WAR is to have src/main/webapp/WEB-INF/lib with src/main/webapp being your top level directory. The WebContent/ is an ECLIPSEism. Now it woule be good if the Maven plugin for Eclipse (m2e) could relocate (virtually) and link the src/main/webapp tree back at the top level of the project for easy access, like Java Source folders do.
So if you are messing with the webappDirectory setting (by removing it) in maven-war-plugin then be aware of the defaults.
-
9. Re: Maven - WEB-INF/lib libraries
maxandersen Mar 21, 2011 1:09 PM (in response to dlmiles)Darryl, Project Explorer shows webresources at "root" level. Is that what you are asking for ?