Maven创建一个空文件夹,而不是获取适当的.jar [英] Maven creates an empty folder instead of get the appropriate .jar

查看:76
本文介绍了Maven创建一个空文件夹,而不是获取适当的.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Maven creates an empty folder instead of get the appropriate .jar.

我有一个项目,该项目包含3个模块:其中一个模块是另两个模块的公用部分.虽然有两个模块生成WAR文件,但是第三个模块必须生成JAR,该JAR应该嵌入其他两个WEB-INF/lib文件夹中.

I have a project that consists of 3 modules: one of the modules is the common part to the other two. While two modules produce WAR files, the third must produce a JAR which should be embedded in the other two WEB-INF/lib folder.

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

The JAR project is a simple "library" project. When I end my job I run a "install" goal to put that on my local repository, and it's work ! Other prject see them, can use its classes and all other stuff. When I try to build a WAR file, maven copy all dependencies into WEB-INF/lib folder as jar file, except my third project. Maven create an empty folder named as my project with ".jar" suffix.

我该如何解决?

我的WAR项目pom.xml文件

My WAR project pom.xml file

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

推荐答案

对我有用的东西:

在项目的设置文件中

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

删除了以下行:

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

Maven依赖项描述(先前失败)遵循/WebContent.像这样:

The Maven dependency description (which failed beforehand) follows the /WebContent one. Like this:

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

知道这个魔术是如何发生的吗?

Any idea how this magic happened?

这篇关于Maven创建一个空文件夹,而不是获取适当的.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆