使用Eclipse在JBoss上部署时,WEB-INF / lib文件夹消失

时间:2012-09-12 14:18:49

标签: java eclipse java-ee maven seam

我正在尝试在JBoss 7.1.1上部署一个简单的Seam 3应用程序。 该项目使用Maven,但也是一个动态Web项目,因此它可以直接在我配置的JBoss服务器上运行。 我正在使用Eclipse Juno for Java EE。

项目结构是:

  • 的src /主/ JAVA
  • 的src /主/资源
  • 的src /主/ web应用
  • 的src /测试/ JAVA
  • 的src /测试/资源
  • 的pom.xml

事情是,在我做了一个mvn之后:clean,mvn:package - > src / main / webapp / WEB-INF的所有内容都被复制到“target / project / WEB-INF”文件夹中。此外,正常情况下WEB-INF下有一个“lib”文件夹。相同的内容出现在project.war存档中。

但是,在服务器运行后执行“在服务器上运行...”或“完全发布”后,整个WEB-INF / lib文件夹就会从战争中消失!我检查了JBoss部署文件夹中爆炸的战争,除了这个文件夹外,一切都在那里..

如果我尝试手动复制它,它可以工作,但我希望有可能进行调试,这就是我想要使用Eclipse方法的原因。

有关正在发生的事情的任何想法?

在下面找到我正在使用的pom.xml:

<?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>

编辑:我也尝试过JBoss 7插件(from here),现在我可以做一个mvn:jboss-as:deploy。但是,没有更好的结果..WEB-INF / lib仍然是空的。

3 个答案:

答案 0 :(得分:0)

你试过mvn:deploy吗?请注意,有关项目结构的配置是在maven上,而不是在JBoss服务器上

答案 1 :(得分:0)

不要Run as..run on server" or a "Full publish"

在standalone.conf(standalone.conf.bat)中启用jpda设置,并对localhost使用远程调试。默认端口为8787.要部署war使用mvn:jboss-as:deploy或手动复制deployments目录中的war文件。

答案 2 :(得分:0)

在Eclipse上,选择您的Web项目->右键单击->属性->部署程序集->添加-> Java构建路径条目-> Maven依赖项

通过此步骤,当完全发布wildeclipse时,maven库将包含在WEB-INF / lib中。