Reputation: 1889
I realize anywhere from very similar to identical questions have been asked numerous times on StackOverflow, but most if not all seem to end up having different solutions.
I have tried almost everything that I have found from similar questions posted here and elsewhere, yet I still can't get Maven to put the dependency JARs in WEB-INF/lib.
The oddest thing is that every time I run Maven -> Update Project, Maven seems to reconfigure the class output folder to be /target/classes
instead of /war/WEB-INF/classes
which is required by the Google web app plugin.
Everything shows up correctly under Maven Dependencies in the build path, but nothing shows up in WEB-INF/lib, so the app fails with ClassNotFoundExceptions at runtime.
Here is the relevant part of the pom.xml:
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<webXml>war/WEB-INF/web.xml</webXml>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>RELEASE</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Is there something I have to configure in the M2E settings? Do I need to use a maven terminal command? I am really at a loss for what to do other than manually manage all dependencies (please... no).
Upvotes: 2
Views: 3011
Reputation: 66
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
</build>
Add that to your pom. It will stop the output directory changing everytime you do a Maven Update.
Upvotes: 2