2

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

项目结构为:

  • 源/主/java
  • 源/主/资源
  • src/main/webapp
  • 源/测试/java
  • 源/测试/资源
  • 目标
  • 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 插件(从这里),现在我可以做一个 mvn:jboss-as:deploy。但是,没有更好的结果..WEB-INF/lib 仍然是空的。

4

3 回答 3

2

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

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

于 2019-12-02T14:36:05.317 回答
0

你试过 mvn:deploy 吗?注意项目结构的配置是在maven上,而不是在JBoss server

于 2012-09-12T15:00:26.030 回答
0

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

jpda在standalone.conf (standalone.conf.bat) 中启用设置并使用远程调试到本地主机。默认端口为 8787。部署战争使用mvn:jboss-as:deploy或手动复制deploymentsdir 中的战争文件。

于 2012-09-24T09:11:36.743 回答