1.打包
-
需要将第三方jar包打进程序中,而不是简单的依赖引用:
<!-- 嵌入所有编译和运行时作用域依赖关系,除了那些在给定列表中使用artifactIds -->
<Embed-Dependency>*;scope=compile|runtime;inline=false;artifactId=!middleware-frame-contract|org.osgi.core</Embed-Dependency>
<!--使用了排除法,因为无法定位到自己的jar包-->
<_exportcontents>*</_exportcontents> //取消重复
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>lib</Embed-Directory>//打进的jar包的位置
<Embed-StripGroup>true</Embed-StripGroup>
<_failok>true</_failok>
<_nouses>true</_nouses>
-
将不是OSGI的jar包bundle:install :
bundle:install wrap:mvn:com.googlecode.protobuf-java-format/protobuf-java-format/1.2
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
<configuration>
<repositoryLayout>flat</repositoryLayout>
<useWildcardClassPath>true</useWildcardClassPath>
<extraJvmArguments>-Xmx1024m</extraJvmArguments>
<programs>
<program>
<id>start</id>
<mainClass>op.Option</mainClass>
<name>start</name>
</program>
</programs>
<binFileExtensions>
<unix>.sh</unix>
</binFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
2. Protobuf 命令生成文件
protoc -I=D:/ceeetyProducsecuritywaittimeListPb.proto --java_out=D:/proto/ D:/ceeetyProducsecuritywaittimeListPb.proto
proto -I=D:/ceeetyProducsecuritywaittimeListPb