我使用addjars-maven-plugin
所有存在于web-inf/lib
罐子添加到我的classpath
和我能够建立我web-application
并将其打包为war
。
是否有任何类似的方式来增加所有目前在some folder
到classpath
的罐子,同时建立java classes
和封装它作为jar
?
我试图下同插件。但是,当我尝试建立我的项目,罐子被下载到我的local repository
。但我仍然得到类未发现异常。
请帮助。提前致谢!
<build>
<plugins>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.basedir}/src/main/extlib</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
全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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>testlogger</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.basedir}/src/main/extlib</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我可以实现通过使用addjars - Maven的插件上面一样,但增加存在的任何文件夹中的罐子,我不得不做出的唯一改变是改变插件从1.0.2版本,以1.0.5。感谢所有的支持!
我曾与addjars-maven-plugin
同样的挑战。调用mvn clean install
它成功但在Eclipse构建(RAD 9.5)我的源文件不能由于缺少罐子的编译。现在添加maven-compiler-plugin
:
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>${some.dir}/libs/*.jar</include>
</includes>
</configuration>
</plugin>
然而那些罐子不是在项目结构下Maven Dependencies
增加。