我是Maven的初學者,我想從多個第三方庫的.java創建.jar文件。我在我的項目中使用了超過32個庫,我需要編譯該項目,以便在CQ5 OSGi中使用它。我有這個在我的pom.xml用於OSGi部署的多個第三方庫的Maven編譯
<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的這樣做的任何幫助將是不錯的。
BTW我怎麼能編譯使用標誌是java文件像
@Service(DfsHandler.class)
@Component(label = "DFS Connection Handler", immediate = true, metatype = true)
感謝您的幫助
我已經更新了上面的答案。您通常不會將依賴項放在src/main/resources中。此位置通常用於靜態資產/配置文件等。但是,如果您希望保留此位置,請將systemPath更新爲如下所示:' $ {project.basedir} /src/main/resources/swingx-0.9。 3.jar ' –
diffa
非常感謝!現在我可以用所有的庫編譯它,但由於\ @Service和\ @Component,我仍然遇到錯誤。我已經在的部分添加了Apache Felix SCR maven插件,但它仍然相同。 –
Jakolcz
SCR註釋依賴項也需要使用註釋來編譯項目。我已將詳細信息添加到答案中。 – diffa