Maven创建一个空文件夹,而不是获取相应的.jar

时间:2015-06-26 14:24:40

标签: java maven

Maven创建一个空文件夹,而不是获取相应的.jar。

我有一个由3个模块组成的项目:其中一个模块是另外两个模块的共同部分。当两个模块生成WAR文件时,第三个模块必须生成一个JAR,它应该嵌入另外两个WEB-INF / lib文件夹中。

JAR项目是一个简单的"库"项目。当我结束工作时,我会运行"安装"将它放在我的本地存储库上的目标,它的工作!其他项目看到它们,可以使用它的类和所有其他东西。当我尝试构建WAR文件时,maven将所有依赖项作为jar文件复制到WEB-INF / lib文件夹中,除了我的第三个项目。 Maven使用" .jar"创建一个名为我的项目的空文件夹。后缀。

我该如何解决?

我的WAR项目pom.xml文件

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

<parent>
    <groupId>it.m2sc.com</groupId>
    <artifactId>LiveDocs</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>UIM</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>UIM</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <cxf.version>2.2.2</cxf.version>
    <spring.version>2.5.6</spring.version>
    <webapp.path>src/main/webapp/</webapp.path>
</properties>

<dependencies>
    <!-- UIMDomain -->
    <dependency>
        <groupId>it.m2sc.com</groupId>
        <artifactId>UIMDomain</artifactId>
        <version>3.2</version>
    </dependency>
    <!-- Adobe dependencies -->
    <dependency>
        <groupId>com.adobe</groupId>
        <artifactId>adobe-livecycle-client</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.adobe</groupId>
        <artifactId>adobe-repository-client</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.adobe</groupId>
        <artifactId>adobe-usermanager-client</artifactId>
        <version>1.0</version>
    </dependency>
    <!-- Base dependencies -->
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.2</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <scope>provided</scope>
    </dependency>
    <!-- Apache CXF dependencies -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <!-- Spring dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <!-- Other dependencies -->
    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.0</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>2.1_3</version>
    </dependency>
    <dependency>
        <groupId>org.opensymphony.quartz</groupId>
        <artifactId>quartz-all</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>net.sf.json-lib</groupId>
        <artifactId>json-lib-ext-spring</artifactId>
        <version>1.0.2</version>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <finalName>UIMBack</finalName>
    <plugins>
        <!-- Compile -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <!-- Build -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:0)

对我有用的东西:

在项目的设置文件中

.settings/org.eclipse.wst.common.component 

删除了以下行:

<wb-resource deploy-path="/" source-path="/WebContent"/>

Maven依赖描述(事先失败)遵循/ WebContent。像这样:

<dependent-module archiveName="____.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/____">
    <dependency-type>uses</dependency-type>
</dependent-module>

知道这个魔法是怎么发生的吗?