2
votes

I am trying to deploy a simple Seam 3 application on JBoss 7.1.1. The project uses Maven but is also a Dynamic web project so it can be run directly on my configured JBoss server. I am using Eclipse Juno for Java EE.

The project structure is:

  • src/main/java
  • src/main/resources
  • src/main/webapp
  • src/test/java
  • src/test/resources
  • target
  • pom.xml

The thing is, after I do a mvn:clean, mvn:package -> all the contents of the src/main/webapp/WEB-INF are copied to the "target/project/WEB-INF" folder. Also, there is a "lib" folder under WEB-INF as normal. The same contents appear in the project.war archive.

But, after doing a "Run as..run on server" or a "Full publish" if the server is running, the whole WEB-INF/lib folder disappears from the war! I checked the exploded war in the JBoss deployments folder and everything is there, except for this folder..

If I try copying it manually, it works, but I want to have the possibility to debug and that's why I want to use the Eclipse approach.

Any ideas of what is going on?

Find below the pom.xml that I am using:

<?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>test.project</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>alpha</version>
<name>test</name>

<properties>
    <seam.version>3.1.0.Final</seam.version>        
    <drools.version>5.4.0.Final</drools.version>
    <jpamodelgen.version>1.1.1.Final</jpamodelgen.version>
    <primefaces.version>3.3</primefaces.version>
    <arquillian.version>1.0.1.Final</arquillian.version>
    <junit.version>4.8.1</junit.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.seam</groupId>
            <artifactId>seam-bom</artifactId>
            <version>${seam.version}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>${arquillian.version}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>


<dependencies>

    <!--  Commons  -->
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.3</version>
    </dependency>

    <!--  Java EE 6.0  -->
    <dependency>
        <groupId>org.apache.openejb</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0-4</version>
    </dependency>

    <!--  Seam International  -->
    <dependency>
       <groupId>org.jboss.seam.international</groupId>
       <artifactId>seam-international</artifactId>   
       <!--  <scope>runtime</scope>-->
    </dependency>

    <!--  Seam Mail  -->
    <dependency>
        <groupId>org.jboss.seam.mail</groupId>
        <artifactId>seam-mail</artifactId>
        <scope>compile</scope>
    </dependency>

    <!-- Seam Security -->
    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-core</artifactId>
        <version>${drools.version}</version><!--$NO-MVN-MAN-VER$-->
    </dependency>

    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
        <version>${drools.version}</version><!--$NO-MVN-MAN-VER$-->
    </dependency>       

    <dependency>
        <groupId>org.jboss.seam.security</groupId>
        <artifactId>seam-security</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.seam.persistence</groupId>
        <artifactId>seam-persistence</artifactId>
    </dependency>

    <dependency>
        <groupId>org.jboss.seam.transaction</groupId>
        <artifactId>seam-transaction</artifactId>
    </dependency>   

    <!-- Seam Faces required for messages support -->
    <dependency>
        <groupId>org.jboss.seam.faces</groupId>
        <artifactId>seam-faces</artifactId>
    </dependency>

    <dependency>
        <groupId>org.jboss.seam.faces</groupId>
        <artifactId>seam-faces-api</artifactId>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
    </dependency>

    <dependency>
        <groupId>org.jboss.solder</groupId>
        <artifactId>solder-impl</artifactId>
    </dependency>

    <!-- CDI (JSR-299) -->
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- Bean Validation (JSR-303) -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- Bean Validation Implementation -->
    <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
    <!-- Hibernate Validator is the only JSR-303 implementation at the moment, 
        so we can assume it's provided -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.0.0.GA</version>
        <scope>provided</scope>
    </dependency>

    <!-- JSF -->
    <dependency>
        <groupId>org.jboss.spec.javax.faces</groupId>
        <artifactId>jboss-jsf-api_2.0_spec</artifactId>
        <scope>provided</scope>
    </dependency>       

    <!--  Pretty faces  -->
    <!--<dependency>
        <groupId>com.ocpsoft</groupId>
        <artifactId>ocpsoft-pretty-time</artifactId>            
    </dependency>

    <dependency>
        <groupId>com.ocpsoft</groupId>
        <artifactId>prettyfaces-jsf2</artifactId>           
    </dependency>

    <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>2.1</version>
    </dependency>-->

    <!--  Prime faces  -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.3</version>
    </dependency>

    <!-- Dependencies used in testing -->   

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <defaultGoal>package</defaultGoal>
    <finalName>vms</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <classpathContainers>
                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5</classpathContainer>
                    </classpathContainers>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <ejbVersion>3.0</ejbVersion>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>                
            <configuration>
                <!-- activate only when you need to generate the metamodel -->
                <!-- <compilerArgument>-proc:none</compilerArgument> -->
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <additionalBuildcommands>
                    <!-- annoyingly creates a bin directory <buildCommand> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> 
                        </buildCommand> -->
                    <buildCommand>
                        <name>org.jboss.tools.common.verification.verifybuilder</name>
                    </buildCommand>
                </additionalBuildcommands>
                <additionalConfig>
                    <file>
                        <name>.settings/org.maven.ide.eclipse.prefs</name>
                        <content>eclipse.preferences.version=1
                            fullBuildGoals=process-test-resources
                            includeModules=false
                            resolveWorkspaceProjects=true
                            resourceFilterGoals=process-resources
                            resources\:testResources
                            skipCompilerPlugin=true
                            version=1</content>
                    </file>
                </additionalConfig>
                <additionalProjectFacets>
                    <jst.jsf>2.0</jst.jsf>
                </additionalProjectFacets>
                <additionalProjectnatures>
                    <projectnature>org.eclipse.wst.jsdt.core.jsNature</projectnature>
                    <projectnature>org.jboss.tools.jsf.jsfnature</projectnature>
                </additionalProjectnatures>                 
                <wtpdefaultserver>JBossAS</wtpdefaultserver>
                <wtpversion>2.0</wtpversion>
                <!-- <downloadSources>true</downloadSources> 
                     <downloadJavadocs>true</downloadJavadocs> -->
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>

    </plugins>
</build>

<profiles>
    <profile>
        <id>distribution</id>
        <activation>
            <property>
                <name>release</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </profile>

    <profile>
        <id>jboss-public-repository</id>
        <activation>
            <property>
                <name>jboss-public-repository</name>
                <value>!false</value>
            </property>
        </activation>
        <repositories>
            <repository>
                <id>jboss-public-repository-group</id>
                <name>JBoss Public Maven Repository Group</name>
                <url>http://repository.jboss.org/nexus/content/groups/public</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>never</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                    <updatePolicy>never</updatePolicy>
                </snapshots>
            </repository>
            <repository>
                <id>prime-repo</id>
                <name>Prime Repo</name>
                <url>http://repository.primefaces.org</url>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>jboss-public-repository-group</id>
                <name>JBoss Public Maven Repository Group</name>
                <url>http://repository.jboss.org/nexus/content/groups/public</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>never</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                    <updatePolicy>never</updatePolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>

    <profile>
        <id>jbossas7</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <property>
                <name>arquillian</name>
                <value>jbossas-managed-7</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <webResources>
                            <resource>
                                <directory>src/main/resources</directory>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

    <!-- Functional test profiles -->
    <profile>
        <id>ftest</id>
        <activation>
            <property>
                <name>arquillian</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <includes>
                            <include>**/ftest/*Test.java</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>verify</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Edit: I have also tried the JBoss 7 plugin (from here) and now I can do a mvn:jboss-as:deploy. But, with no better results..WEB-INF/lib is still empty.

3
Please check if this question/answer helps you: [Maven dependencies not visible in WEB-INF/lib][1]. This looks a lot like the problem you're having. [1]: stackoverflow.com/questions/6083501/…Pedro Nunes
@Pedro - thank you for the comment, the link you provided did help me improve my project configuration.AndaP

3 Answers

2
votes

On Eclipse, select your Web Project -> right click -> Properties -> Deployment Assembly -> Add -> Java Build Path Entries -> Maven Dependencies

With this steps, maven libraries will be included on WEB-INF/lib when full publish wildfly eclipse.

0
votes

Have you tried mvn:deploy ? Note that the configuration about the project structure is on maven, but not in JBoss server

0
votes

Don't do Run as..run on server" or a "Full publish"

Enable jpda settings in standalone.conf (standalone.conf.bat) and use remote debug to localhost. Default port is 8787. To deploy war use mvn:jboss-as:deploy or copy war file in deployments dir manually.