gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:54:35 24 4
gpt4 key购买 nike

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

我有一个由 3 个模块组成的项目:其中一个模块是其他两个模块的公共(public)部分。当两个模块生成 WAR 文件时,第三个模块必须生成一个 JAR,该 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>

最佳答案

对我有用的东西:

在项目的设置文件中

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

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

关于java - Maven 创建一个空文件夹而不是获取适当的 .jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31075703/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com