Maven强势打包

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
  • Maven打包可用命令启动的jar包。
    <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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,994评论 6 342
  • 场景 单机应用已经越来越不能符合目前越来越复杂的产品需求了。即使是小型应用,至少也需要部署2台以上的服务器做集群。...
    IvanEye阅读 3,633评论 3 11
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,200评论 19 139
  • 1.编写POM Maven项目的核心文件是pom.xml,POM(Project Objcet Model)项目对...
    zlcook阅读 5,951评论 7 26
  • Maven简单介绍 Maven是一个项目管理工具。强大,但是很容易使用。 它包含了: 一个项目对象模型 (Proj...
    高公子Daniel阅读 4,281评论 4 60