I'm working on a simple JSF 2 application and I'm having trouble with the managed beans. I was getting errors saying that the bean cannot be found and when I looked at the war it didn't have any compiled beans. In my pom.xml I had the following:
<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>com.traintrack</groupId>
<artifactId>test</artifactId>
<version>SNAPSHOT</version>
<packaging>war</packaging>
<name>test</name>
<build>
<outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.7.Final</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
If I remove the WebContent folder from the warSourceDirectory I get the rest of my project in the war file but this doesn't seem right. The file was generated by eclipse so I would assume it's ok. In WEB-INF there is a classes folder which is empty.
My project folder structure is:
test
- src/
- sample/
- sampleBean.java
- WebContent/
- sample.xhtml
- WEB-INF/
- faces-config.xml
- web.xml
- META-IF/
but my compiled war file's structure is like this:
test
- sample.xhtml
- WEB-INF/
- faces-config.xml
- web.xml
- classes/
- META-IF/
What should be packaged in my war file and where should the compiled bean be?
Thanks
src/main/webapp
? Furthermore it would be helpfull to see the full pom file... – khmarbaise Apr 6 '15 at 16:20