Maven and working with legacy app

2019-06-10 00:02发布

In order to work with a legacy app framework I need to split a webapp project into 2. 1 jar needs to have the java class files, the other will have all the web stuff like jsps, css, et. al.. How can I do this with on maven-3 pom?

标签: maven-3
1条回答
何必那么认真
2楼-- · 2019-06-10 00:42

For this purpose you can use the configuration of the maven-war-plugin. This will create a separate jar file which contains the .class files...

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
      <attachClasses>true</attachClasses>
    </configuration>
</plugin>

like xyz-1.0.0-SNAPSHOT-classes.jar which can be used as a separated dependency (you have to use the supplemental classifier).

If the war artifact should not contain any classes, you can achieve this by adding the packagingExcludes configuration.

      <packagingExcludes>WEB-INF/classes/**</packagingExcludes>
查看更多
登录 后发表回答