我是 Maven 的初学者,我想从我的 .java 中创建带有多个 3rd 方库的 .jar 文件。我在我的项目中使用了超过 32 个库,我需要编译该项目,以便可以在 CQ5 OSGi 中使用它。我的 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>info.hartmann.dfs</groupId>
<artifactId>dfs-connection-handler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DFS connection handler</name>
<build>
<sourceDirectory>C:\Users\302104\workspace\DFS\src</sourceDirectory>
<resources>
<resource>
<directory>C:\Users\302104\workspace\lib</directory>
</resource>
</resources>
<directory>C:\Users\302104\workspace\DFS\target</directory>
<finalName>dfs-connection-handler-0.0.1-SNAPSHOT</finalName>
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<executions>
<execution>
<id>install-bundle</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<slingUrl>http://localhost:4502/system/console</slingUrl>
<user>user</user>
<password>password</password>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>wrap-my-dependency</id>
<goals>
<goal>wrap</goal>
</goals>
<configuration>
<wrapImportPackage>;</wrapImportPackage>
</configuration>
</execution>
</executions>
<configuration>
<instructions>
<export-package>info.hartmann.dfs</export-package>
<import-package>
java.util.List;resolution=optional,
com.emc.documentum.fs.datamodel.core.*;resolution=optional,
com.emc.documentum.fs.datamodel.core.content.*;resolution=optional,
com.emc.documentum.fs.datamodel.core.profiles.*;resolution=optional,
com.emc.documentum.fs.datamodel.core.query.*;resolution=optional,
com.emc.documentum.fs.rt.context.*;resolution=optional,
com.emc.documentum.fs.services.core.client.*;resolution=optional,
*
</import-package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
我几乎不知道我在用这个 pom.xml 做什么,所以任何帮助都会很好。
顺便说一句,我怎样才能使用像这样的标记来编译那个 .java 文件
@Service(DfsHandler.class)
@Component(label = "DFS Connection Handler", immediate = true, metatype = true)
谢谢你的帮助