Maven WAR - sources are not going to

Hi,

I am trying to build my web application using maven, but I ran into some difficulties.

Maven collects my war file and puts everything in its place, except for the compiled classes. It seems like my sources are not even compiling.

My folder structure is as follows:

src src/main src/main/java src/main/java/com src/main/java/com/test src/main/java/com/test/applications src/main/java/com/test/applications/TestApplication.java src/main/resources src/main/webapp src/main/webapp/media src/main/webapp/media/someimages.jpg src/main/webapp/styles src/main/webapp/styles/somecss.css src/main/webapp/WEB-INF src/main/webapp/WEB-INF/web.xml src/main/webapp/scripts src/main/webapp/scripts/jquery src/main/webapp/scripts/jquery/jquery-1.5.js pom.xml 

and my pom.xml looks like this:

 <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.test</groupId> <artifactId>TestApp</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>TestApp Maven Webapp</name> <url>http://maven.apache.org</url> <build> <finalName>TestApp</finalName> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> 

The collected files file looks fine, except that the WEB-INF / classes folder is empty. I am building with Jenkins and Maven 3.0.2.

Any help would be very receptive.

Best regards, Chris

+8
java maven web-applications
source share
2 answers

The problem can be solved:

As mentioned in the commentary, I still had some old configuration to work on creating jenkins, where it would use the goal of war: war to create a project.

After removal, it worked fine.

+2
source share

I had the same problem (except that I am not using jekins). NOTE. I used the creation of a maven web application:

 mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=myGroupID -DartifactId=myArtifactID 

The folder structure of the Webapp project had the following folder: 'src / main / resources', which contained all my sources (.java files).

when I changed the name of the "resources" folder to "java" (which meant "src / main / java") from a sugestion friend, all I had to do was call "mvn clean install" to have a military file containing compiled classes.

I hope that my answer will be quite detailed.

+1
source share

All Articles