官术网_书友最值得收藏!

Using thin JARs

You will be able to create a thin JAR. A thin JAR does not contain its Maven dependencies and loads them during application startup from a local or remote Maven repository.

Example reference: chapter3/catalog-service-thin-jar.

Let's take a look at an example:

(...)

<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<!-- 1 -->
<configuration>
<bundleDependencies>false</bundleDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

(...)

When we build the application and look at the target directory, we get the following result:

Note that in the preceding scenario, all the JARs are very small with the runnable JAR of 744 KB.

You also have the possibility to mix thin JARs with hollow JARs. The runnable JAR does not contain the application that has to be deployed on it, so it has to be run in the same way as in the preceding example:

java jar catalog-1.0-hollow-swarm.jar catalog-1.0.war

Both the server and the deployment do not contain bundled dependencies, so they have to be loaded from the Maven repository using the application deployment.

主站蜘蛛池模板: 屏边| 霍林郭勒市| 肃宁县| 临澧县| 陵水| 且末县| 修武县| 贵德县| 隆安县| 若羌县| 拜泉县| 东方市| 临西县| 丹凤县| 武威市| 彭阳县| 韶关市| 普格县| 清镇市| 鲁山县| 黄平县| 衡阳县| 阿克苏市| 新余市| 循化| 乌兰县| 武穴市| 房产| 南召县| 康马县| 江北区| 和田县| 商南县| 巴南区| 博罗县| 鄢陵县| 武穴市| 理塘县| 郑州市| 贡觉县| 清镇市|