在maven build中的WEB-INF中找不到java类

时间:2012-06-11 05:51:50

标签: flex web-applications maven maven-3 flexmojos

我正在开发一个在后端使用flex和Java的项目。这是一个网络应用程序项目。事情就是当我通过Eclipse编译它时,它很好。但是当我使用maven来构建战争时,我不会在我的WEB-INF\classes文件夹中获取类文件。如果有人遇到这样的问题,我没有任何错误,但仍然没有类文件。

我在这里附上了我的POM文件

<?xml version="1.0" ?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.abc.def</groupId>
    <artifactId>abc-cde</artifactId>
    <version>0.1</version>
    <packaging>war</packaging>

    <name>abc-cde</name>

    <build>
        <sourceDirectory>src/clv_web_flex/Mxmls</sourceDirectory>
        <plugins>
            <plugin>
                <!-- Plugin runs on Maven version 3.0.3 and so on -->
                <groupId>org.sonatype.flexmojos</groupId>
                <artifactId>flexmojos-maven-plugin</artifactId>
                <version>4.2-beta</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>copy-flex-resources</goal>
                        </goals>
                        <configuration>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <!-- Excludes jar file in WAR -->
                    <packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>WebContent</directory>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.adobe.flexunit</groupId>
            <artifactId>flexunit</artifactId>
            <version>0.85</version>
            <type>swc</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.adobe.flex.framework</groupId>
            <artifactId>flex-framework</artifactId>
            <version>4.5.1.21328</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.flex</groupId>
            <artifactId>spring-flex-core</artifactId>
            <version>1.5.2.RELEASE</version>
        </dependency> 
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>blazeds-common</artifactId>
            <version>3.2.0.3978</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>blazeds-core</artifactId>
            <version>3.2.0.3978</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>blazeds-proxy</artifactId>
            <version>3.2.0.3978</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>blazeds-remoting</artifactId>
            <version>3.2.0.3978</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>cfgatewayadapter</artifactId>
            <version>0.020108</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-messaging-common</artifactId>
            <version>4.0.0.14931</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-messaging-core</artifactId>
            <version>4.0.0.14931</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-messaging-opt</artifactId>
            <version>4.0.0.14931</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-messaging-proxy</artifactId>
            <version>4.0.0.14931</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-messaging-remoting</artifactId>
            <version>4.0.0.14931</version>
        </dependency>
        <dependency>
            <groupId>com.adobe.blazeds</groupId>
            <artifactId>flex-rds-server</artifactId>
            <version>272564</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.4.1</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>spring-external</id>
            <name>Spring External Repository</name>
            <url>http://maven.springframework.org/external</url>
        </repository>
        <repository>
            <id>flex-mojos-repository</id>
            <url>http://repository.sonatype.org/content/groups/flexgroup</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>flex-mojos-plugin-repository</id>
            <url>http://repository.sonatype.org/content/groups/flexgroup</url>
        </pluginRepository>
    </pluginRepositories>
</project>

我运行mvn install插件。提前感谢!

1 个答案:

答案 0 :(得分:0)

如果您尝试删除JAR文件而不删除其他文件,则应将<packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>替换为<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>