我知道过去曾经多次询问过这个问题,但我找不到解决办法(除了“在Eclipse中手动将.jar添加到你的项目中”)。
我有什么:
kc.ourwebservice
)在Eclipse中使用 clean install
(在Eclipse中或通过命令行)和完全发布之后(是的,我已经完成了更新Maven项目 - 在此之前强制更新快照/版本,此.jar
可在以下位置找到:
mvn dependency:tree -Dverbose
.m2
文件夹但是,部署的JBoss .war
的{{1}}文件夹中缺少它,这就是我的问题所在。
我知道我可以在Eclipse'部署程序集(或lib
文件)中手动添加.jar
,但每次我切换git分支或执行“更新Maven项目“,它又消失了。当项目放在服务器上时,我也不想手动添加此org.eclipse.wst.common.component
我需要一个永久的解决方案,以便使用为其设计的Maven插件将.jar
正确添加到已部署的JBoss .jar
。
要添加一件事。此网络服务同时包含.war
和.aar
。两者都是必要的。当我们启动应用程序时.jar
,所以我给它一个.jar
,我们使用的所有<scope>compile</scope>
只在运行时需要,所以我给了它那个范围({{ 1}})。
以下是相关的.aar
代码(<scope>runtime</scope>
的许多依赖项,插件和代码,但这些与此问题无关):
pom.xml
是否有人知道为什么...
未部署到<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>
<parent>
...
</parent>
<artifactId>...</artifactId>
<packaging>war</packaging>
...
<properties>
...
<ourwebservice.version>1.0.0</ourwebservice.version>
...
</properties>
...
<plugins>
...
<!-- Takes care of copying the aar services to the WEB-INF/services -->
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-repo-maven-plugin</artifactId>
<version>1.7.3</version>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<stripServiceVersion>false</stripServiceVersion>
<services>...,ourwebservice</services>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<id>deploy webservices</id>
<goals>
<goal>create-repository</goal>
</goals>
</execution>
</executions>
</plugin>
...
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<outputDirectory>${warOutputDir}</outputDirectory>
<webappDirectory>${webappDirectory}</webappDirectory>
<warName>${project.artifactId}</warName>
<!-- Tell the maven war plugin to use the merged web.xml -->
<webXml>${warOutputDir}/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
<webResources>
<resource>
<directory>${basedir}/src</directory>
<targetPath>WEB-INF/classes</targetPath>
<excludes>
<exclude>**/*.java</exclude>
<exclude>sample-properties.properties</exclude>
<exclude>sample-log4j.properties</exclude>
</excludes>
</resource>
<!-- Copy the generated services that were extracted from the dependencies to the WEB-INF/services folder of the war archive. -->
<resource>
<directory>${project.build.directory}/generated-resources/services</directory>
<targetPath>/WEB-INF/services</targetPath>
<includes>
<include>**/*.aar</include>
</includes>
</resource>
...
</webResources>
<!-- The axis2 services should not be stored in the WEB-INF/lib -->
<packagingExcludes>WEB-INF/lib/*.aar</packagingExcludes>
</configuration>
</plugin>
<!-- JBoss plugin used to deploy war file - http://mojo.codehaus.org/jboss-maven-plugin/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<hostName>${deploymentHostName}</hostName>
<port>${deploymentPort}</port>
<fileName>${deploymentFileName}</fileName>
<serverName>default</serverName>
<jbossHome>
//${deploymentHostName}/${jbossHome}
</jbossHome>
</configuration>
</plugin>
</plugins>
...
<dependencies>
...
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>aar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
...
</dependencies>
...
</project>
?或者更好的是,是否有人知道解决方案,因此在进行全新安装和发布时,.jar
始终部署到此.war
?
.jar
中存在所有其他.war
个文件,此网络服务是唯一缺失的文件。