[英]How to change output directory of moduleSet/sources with maven-assembly-plugin
[英]How to give an output directory in maven bundle plugin
我開始創建OSGI包。 所以它工作正常。 但是,當我將輸出目錄放在maven bundle plugin的配置部分中時,它不會添加任何已編譯的類。 簡而言之,類路徑為空。我也在使用maven編譯器插件。 他們彼此沖突嗎? 有什么我配置錯誤的方法嗎? 這是我的pox.xml文件的build部分。
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
demo.wso2.orderprocess.*
</Export-Package>
</instructions>
<outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>
</configuration>
</plugin>
</plugins>
這是我為解決此問題所做的工作,它確實有效!!!
將項目打包類型保留為“ jar”,然后向其中添加OSGI元數據。 這可以通過向maven-bundle-plugin添加執行目標並從maven-jar-plugin引用它來實現 。 現在,只需將outputDirectory路徑添加到要放置jar的maven-jar-plugin中。
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
<outputDirectory>/path/to/output/directory</outputDirectory>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
現在,要構建項目,請運行以下命令。 這將生成清單文件並將其打包到jar中。
mvn org.apache.felix:maven-bundle-plugin:manifest install
參考:
您應該使用<buildDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</buildDirectory>
而不是<outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>
。 它幫了我大忙,所以現在我可以提高OSGI bundle的開發速度!
參考: Maven Bundle插件文檔
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.