I'm using Eclipse 3.5, Maven 2, m2eclipse and Tomcat 6. So i create Maven project for archetype webapp.
This is pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itransition</groupId>
<artifactId>hello</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>hello Maven Webapp</name>
<url>http://maven.apache.org</url>
<!-- tools.jar dependency -->
<profiles>
<profile>
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>hello</finalName>
</build>
</project>
So then i want to deploy my web application to Tomcat. What I need to do? Maven install don't help. But if I create war by Maven install, i can import it to eclipse and deploy it to Tomcat by "Add and remove..." in server popup.
This problem can be resolved by using the Tomcat plugin for Maven. Its homepage has got extensive documentation concerning the configuration of the plugin and deployment of war files.
It can be done in 2 ways.
Refer below URL
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
Create maven Project with eclipse and locate the project folder from command prompt (or) Terminal
mvn eclipse:eclipse -Dwtpversion=2.0 [ in project folder ]
Refersh Eclipse project.
Now you can Add and Remove Deployment.
Found out that the tomcat manager url (i am using Tomcat 6.0) is http://localhost:8080/manager/html, while the default used by the mvn tomcat plugin stops at manager in the URL. Add the url specified to your pom.xml as a configuration parameter - (see this url for more details http://mojo.codehaus.org/tomcat-maven-plugin/configuration.html) and voilĂ it works...
With Tomcat7, I found I needed to set up the URL as http://localhost:8080/manager/html and use a username with a manager-gui role. However, using a username with the manager-script role, with URL http://localhost:8080/manager/text also works and is more appropriate. The manager-script role is the designed way to go for ant/maven scripts.
So then i want to deploy my web application to Tomcat. What I need to do? Maven install don't help. But if I create war by Maven install, i can import it to eclipse and deploy it to Tomcat by "Add and remove..." in server popup.
Since you are using m2eclipse, my recommendation would be to deploy your application using the WTP. Assuming you have the Maven integration for WTP feature installed (from m2eclipse extras) and Tomcat configured as Server, just right-click on your project and select Run > Run on Server...
Another option would be to run your application on Jetty (yes, I know that this is not what you're asking for but this is very valid option if you don't want to use the WTP). Add the following snippet to your pom:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
</plugin>
</plugins>
</build>
</project>
And simply run mvn jetty:run to start an embedded Jetty server and deploy your application on it.
The same can be achieved for Tomcat using the Tomcat Maven Plugin but unless you want to deploy to a remote Tomcat (see the Usage page), I don't see any advantage over the Maven Jetty Plugin.
During development, I would use the first option (deploy with the WTP).
If you want that your war file created by maven, should be deploy on tomcat server directly then this tomcat deployment configuration can help you.
Related
I struggle for a few days now with integrating maven and gwt in eclipse. I was searching web for some ready to import project, but unfortunatelly everything crashed so long.
I am new to gwt. I would like learn it. Earlier I was using maven, spring and playframework with sbt.
I haven't use ant like build tool. But I like it integration between gwt and eclipe (I can click run in super dev mode).
One think is that I do not like in ant, I have to manually download jar and put it in classpath. I think it is unnecessary if maven can do it for me.
I would like also to use this library: gwtbootstrap3
I can't handle this on my own.
Can someone of You prepare for me that eclipse project, that I could just import.
Here is my newest pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.korbeldaniel.btsp</groupId>
<artifactId>btsp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>btsp</name>
<properties>
<gwt.version>2.7.0</gwt.version>
<gwtBootstrap3.version>0.9.1-SNAPSHOT</gwtBootstrap3.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<build>
<finalName>btsp</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
But I cant run in like native gwt project.
Yes, it's a definitely possible. You just have to sift through a ton of documentation to figure it out.
You'll need Google Plugin for eclipse and the m2e (Maven Integration for Eclipse) plugin
After you have those, right click on a GWT project-> configure -> convert to Maven Project.
Now, to use GwtBootstrap3, all you need to do is add GWT and gwtBootstrap3 as dependencies in your pom. (Details here).
If you need any ready to import maven projects, you can clone GwtBootstrap3-demo project from github and run that as a web application. As for learning GWT, tutorials are your best option (Pay close attention to UiBinder for GwtBootstrap3).
click here, here and here for details about setting everything up.
I firstly generated a gwt maven project by executing --
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo
-DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.7.0
After that, the pom.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.boye.games</groupId>
<artifactId>games-gwt</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>${gwtVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes" update them in DevMode -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.7.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see
gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<runTarget>LineThree.html</runTarget>
<modules>
<module>com.boye.games.linethree.LineThree</module>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
Then I imported this project into eclipse via built-in eclipse function -- import existing Maven project.
However, the process failed due to several reasons:
GreetingServiceAsync cannot be resolved to a type
Execution default of goal org.codehaus.mojo:gwt-maven-plugin:2.7.0:generateAsync failed:
Plugin org.codehaus.mojo:gwt-maven-plugin:2.7.0 or one of its
dependencies could not be resolved: Failed to collect dependencies for
org.codehaus.mojo:gwt-maven-plugin:jar:2.7.0 ()
(org.codehaus.mojo:gwt-maven-plugin:2.7.0:generateAsync:default:generate-sources)
google plugin can't identify this project as gwt web application automatically.
My environment as follows:
java version 1.7.0_03
eclipse version Kepler Service Release 2
gwt version 2.7.0
Please advice, thanks a lot!
I did another attempt to try in a win32 computer, the problem re-appeared even if I set up the environment as aforementioned working in my win64 computer.
So I really got confused, like Klarki said, I have to do some tweaks to get it work. I generated GreetingServiceAsync via mvn gwt:generateAsync then manually copy GreetingServiceAsync to source folder, then I remove <goal>generateAsync</goal> in pom.xml, then import project via eclipse's existing maven project. It works again!
Sadly see it not working intelligently.
The problem was with generateAsync, which in your case generates GreetingServiceAsync on execution. Eclipse probably wasn't configured to handle it properly and this class was not generated and eclipse reported the missing class warning.
Another thing that could be done to get the project to work was to run mvn package from command line and add the generated dir in target dir as source dir in eclipse (vie right clicking the project and selecting New -> source folder > browsing folder name > target > generated-sources > the right folder)
Also you may run into same issue after you do mvn clean - the generated GreetingServiceAsync will be deleted and the problem may come back.
The problem exists because eclipse isn't tightly integrated with maven and uses its own build system ignoring maven targets that you don't have plugins for. What you could do is to open eclipse preferences > maven > lifecycle mappings and there you can enable generateAsync to execute.
If you copy the generated class manually you have to keep in mind that you need to update it when needed, where as it is intended to generate automatically. So you loose this convenience.
This work for me:
I deleted the local maven gwt repository, in windows 7 it's in C:\Users\.m2\repository\com\google\gwt, and then make a
mvn clean complile
so maven re-import al dependencys.
After I changed my environment as follows:
java version "1.8.0_05"
eclipse Version: Luna Release (4.4.0)
Google plugin for Eclipse 4.4
I works like a charm.
Probably, it's a version incompatibility issue.
I'm using Eclipse Kepler SR2 with m2e.
I have a web project that depends on a jar.
When I use "Run as -> Maven Build..." with goal package and "Check Workspace artifacts" is checked, then the lib folder in the target contains a folder with the name of the dependency jar, instead of the jar itself. The packaged war also contains a folder instead of a jar. However, when deploying to tomcat with m2e, the jar is deployed correctly.
I use maven-war-plugin version 2.4.
This is my WAR pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.modelity.loans</groupId>
<artifactId>loans-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>loans-web</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.modelity.loans</groupId>
<artifactId>loans-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</build>
</project>
And this is the artifact coordinates of the dependency jar:
<parent>
<groupId>com.modelity.loans</groupId>
<artifactId>loans-lib</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>loans-core</artifactId>
<packaging>jar</packaging>
I've looked at the debug output of the maven package goal. When the war plugin is processing the jars, it says
[DEBUG] Processing: loans-core-0.0.1-SNAPSHOT.jar
without indicating the jar has been copied.
Later on in the log I see:
adding directory WEB-INF/lib/loans-core-0.0.1-SNAPSHOT.jar/
I've tried both embedded maven (3.0.4) and external maven (3.0.5).
My colleague uses kepler SR1, and experience the same problem.
I think I've covered it all. Would be happy for some advise, couldn't find any reported bug about it.
Thanks,
Lior
Try installing the jar as its own maven-controlled artifact:
mvn install:install-file -Dfile=my.jar -DgroupId=com.mycorp -DartifactId=my-jar -Dversion=1.0 -Dpackaging=jar
And then define it as a maven dependency for your war
now we have 2018 and the problem still exists in eclipse v2018-09. Maven Dependencies which exist in the workspace are exploded into WEB-INF/lib folder.
Found this old bug report https://issues.jboss.org/browse/JBIDE-22157 regarding this behaviour.
Solution is to disable "dependency resolution from workspace projects" in maven project settings.
regards,
Markus
I created a dynamic web application in eclipse Version: Kepler Service Release 1 using menu.
After that I converted it into a maven project using
configure -> convert to maven project. Then I did
maven->Add dependency and then searched for log4j.
After adding that on hovering over the tag
for log4j it displays Missing artifact log4j:log4j:bundle:1.2.17.
I can't update dependencies using maven. How to fix it?
Please also explain the reason for the error.
Here is the generated xml after adding log4j.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Healthcare</groupId>
<artifactId>Healthcare</artifactId>
<version>0.0.1-HEALTHCARE</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>bundle</type>
</dependency>
</dependencies>
</project>
First why did you changed the default source folder location? The default is src/main/java and for webapp src/main/webapp. Apart from that a bundle for log4j does not exist on Maven Central just remove the <type>bundle</type> from your dependency, cause in Maven Central only a jar is available.
I always do the following trick:
In the dependencies management i edit the dependencies properties (select the dependencies with problem and click on properties button) changing the type from bundled to jar and that fixs the problem.
Well i hope that this solution work for you :) regards,
I too played with all the options provided above but it did not helped. By updating Maven dependencies forcefully my issue got resolved.
Go to project >> Maven >> Update Project
select the project and click OK.
Project will automatically try to download required jar but if still you are getting same error then do below step.
Go to project >> Maven >> Update Project >> check in the checkbox 'Force Update of Snapshots/Releases'
select the project and click OK.
Please check if the dependencies are correct or if it is missing.
<properties>
<springframework.version>4.2.1.RELEASE</springframework.version>
<jackson.version>2.5.3</jackson.version>
<log4j.version>1.2.17</log4j.version>
</properties>
By default (and the common usage), Maven would consume jars as a dependency. Just change the bundle to jar in your pom.xml file in the given dependency which is giving you an error.
Eclipse version: Indigo
Target Application server: Weblogic 10.3.5 (11gR1)
I am having trouble building and deploying a multi-module POM project (packaged as an EAR) to my WebLogic server, within Eclipse.
Despite the parent POM building an EAR file successfully outside of the IDE, I am receiving the following error when trying to deploy the UI WAR to the Application Server:
java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:486)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3027)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:341)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: weblogic.application.ModuleException: Failed to load webapp: 'lerp-ui'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processServlets(WebAnnotationProcessorImpl.java:225)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processJ2eeAnnotations(WebAnnotationProcessorImpl.java:209)
at weblogic.servlet.internal.WebAnnotationProcessorImpl.processAnnotations(WebAnnotationProcessorImpl.java:105)
at weblogic.servlet.internal.WebAppServletContext.processAnnotations(WebAppServletContext.java:1368)
at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:449)
at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:493)
at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:418)
at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:972)
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:382)
This is despite having the jsf-api dependency in both the Maven POM and referenced in the .classpath file for the UI WAR project:
Snippet of the POM for the UI WAR project:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3</version>
</dependency>
.classpath for UI WAR Project:
<classpathentry kind="var" path="M2_REPO/javax/faces/jsf-api/2.0.3/jsf-api-2.0.3.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/faces/jsf-impl/2.0.3/jsf-impl-2.0.3.jar"/>
Below follows the entire parent POM of the multi-module project:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.co.acme</groupId>
<artifactId>multiModulePOMProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>acme troublesome project</name>
<modules>
<module>../../Business/common</module>
<module>../../Business/svccom</module>
<module>../../Business/busctl</module>
<module>../../Client/ui</module>
<module>../../Business/ear</module>
<module>../../Business/talend/java/businessrules</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.ui.version>1.0-SNAPSHOT</project.ui.version>
<project.common.version>1.0-SNAPSHOT</project.common.version>
<project.svccom.version>1.0-SNAPSHOT</project.svccom.version>
<project.busctl.version>1.0-SNAPSHOT</project.busctl.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<webapp.filter>development</webapp.filter>
<spring.version>3.0.5.RELEASE</spring.version>
<eclipselink.version>2.1.3</eclipselink.version>
<persistence.version>2.0.0</persistence.version>
<spring.cdi.version>1.0.0</spring.cdi.version>
<weblogic.adminurl>t3://localhost:7050</weblogic.adminurl>
<weblogic.user>weblogic</weblogic.user>
<weblogic.password>welcome1</weblogic.password>
<weblogic.target>acmeLocalDomain</weblogic.target>
<weblogic.source>../../Business/ear/target/${parent.artifactId}.${packaging}</weblogic.source>
</properties>
<profiles>
<profile>
<id>production</id>
<properties>
<webapp.filter>production</webapp.filter>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
</plugin>
</plugins>
</build>
</project>
It's clear that this is some classpathing issue, but I have gone scrollbind from staring at it over the course of two days and have decided that the time has come to wave the white flag and appeal for help!
The end goal is to take my EAR project (which currently is hampered from an annoying need to undeploy/redeploy on the command line for every little change) and get it so that I can perform hot fixes within a deployment which is run inside the IDE.
Thanks
Update:
By adding the offending dependency to the domains\<domain>\lib folder of the application server, and restarting the application server, I have now started getting ClassNotFoundExceptions for other WAR dependencies. It is clear now that Eclipse is not respecting the classpath of the WAR project - and I still don't understand why or how :-(
To package dependencies into your lib directory, add this to your EAR packaging pom:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
[Your EJB and Web modules here]
</modules>
</configuration>
</plugin>
</plugins>
</build>
Notice the defaultLibBundleDir tag.
After building the EAR using File > Export in Eclipse, I was able to compare the EAR to the one produced by my Maven POM.
I found that Eclipse did not contain references to the Maven Dependencies build path items in the Deployment Assembly (I discovered that simply adding the Projects as dependencies wasn't enough).
Reading around the subject, I found that it was neccessary to add the Maven Dependencies of the child WAR and JARs to their respective WAR and JAR projects, but with a destination of
../lib
This is declared on each WAR and JAR refers to the lib folder of the parent EAR.
Using a combination of this menu (and alternatively by editing each of the corresponding .settings/org.eclipse.wst.common.component files for each affected WAR and JAR in turn) I was able to build up a version of the EAR which matched the one produced via my Maven script.
I hope this helps someone.