Maven 打包 jar、war 包配置

1、导出 jar 包配置

xml 复制代码
    <build>
        <finalName>weaver-customerservice-distribution-component</finalName>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

2、导出 war 包配置

xml 复制代码
   <build>
        <finalName>weaver-customerservice-component-service</finalName>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
相关推荐
小杨4043 小时前
python入门系列十五(asyncio)
人工智能·python·pycharm
Mryan200512 小时前
解决GraalVM Native Maven Plugin错误:JAVA_HOME未指向GraalVM Distribution
java·开发语言·spring boot·maven
1alisa13 小时前
Pycharm v2024.3.4 Windows Python开发工具
ide·python·pycharm
依旧很淡定19 小时前
IntelliJ IDEA更改Maven工程名称
maven·修改名称
南城猿19 小时前
Pycharm中Django框架使用{% load static %}模板,HTML报错
ide·pycharm·django
小杨4041 天前
python入门系列十四(多进程)
人工智能·python·pycharm
小杨4042 天前
python入门系列十三(多线程)
人工智能·python·pycharm
别惊鹊3 天前
(三)安装和使用Maven
java·maven
步木木3 天前
Anaconda和Pycharm的区别,以及如何选择两者
ide·python·pycharm
腥臭腐朽的日子熠熠生辉3 天前
解决maven失效问题(现象:maven中只有jdk的工具包,没有springboot的包)
java·spring boot·maven