dubbo服务提供端合并打jar和分开打jar

<plugins>

=========方式一:lib和程序分离===========

<!--<plugin>

<artifactId>maven-jar-plugin</artifactId>

<configuration>

<classesDirectory>target/classes/</classesDirectory>

<archive>

<manifestEntries>

&lt;!&ndash;<addClasspath>true</addClasspath>&ndash;&gt;

&lt;!&ndash;<classpathPrefix>lib/</classpathPrefix>&ndash;&gt;

&lt;!&ndash;<useUniqueVersions>false</useUniqueVersions>&ndash;&gt;

&lt;!&ndash;<mainClass></mainClass>&ndash;&gt;

&lt;!&ndash;<Specification-Title>${project.artifactId}</Specification-Title>&ndash;&gt;

&lt;!&ndash;<Specification-Version>${project.version}</Specification-Version>&ndash;&gt;

&lt;!&ndash;<Specification-Vendor>hb</Specification-Vendor>&ndash;&gt;

&lt;!&ndash;<Implementation-Title>${project.artifactId}</Implementation-Title>&ndash;&gt;

&lt;!&ndash;<Implementation-Version>${timestamp}</Implementation-Version>&ndash;&gt;

&lt;!&ndash;<Url>${project.url}</Url>&ndash;&gt;

<Class-Path>.</Class-Path>

</manifestEntries>

<manifest>

&lt;!&ndash; <mainClass>com.alibaba.dubbo.container.Main</mainClass>&ndash;&gt;

<mainClass>com.houbank.incoming.service.main.HbIncomingServiceMain</mainClass>

&lt;!&ndash; 打包时 MANIFEST.MF文件不记录的时间戳版本 &ndash;&gt;

<useUniqueVersions>false</useUniqueVersions>

<addClasspath>true</addClasspath>

<classpathPrefix>lib/</classpathPrefix>

</manifest>

</archive>

</configuration>

</plugin>-->

============方式二:打在一个jar中=============

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-shade-plugin</artifactId>

<version>2.4.1</version>

<configuration>

<!-- &lt;!&ndash; 是否生成缩减的pom文件,默认不配置是true &ndash;&gt;-->

<createDependencyReducedPom>false</createDependencyReducedPom>

</configuration>

<executions>

<execution>

<phase>package</phase>

<goals>

<goal>shade</goal>

</goals>

<configuration>

<transformers>

<transformer

implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">

<!-- &lt;!&ndash; 启动类 &ndash;&gt;-->

<mainClass>com.houbank.incoming.service.main.HbIncomingServiceMain</mainClass>

</transformer>

</transformers>

</configuration>

</execution>

</executions>

</plugin>

</plugins>

相关推荐