mvn项目打源码包

有两种方式:

1、单独打源码包,单独看jar包不能看源码。

mvn clean source:jar install

2、将源码打入到jar里

在pom中引用插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.3</version>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/java</directory>
                        <includes>
                            <include>**/*.java</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

参考:https://stackoverflow.com/questions/23933911/include-source-code-while-exporting-a-jar-using-maven

https://stackoverflow.com/questions/25779900/how-to-include-source-file-java-file-parallel-to-class-file-in-the-generated

https://blog.csdn.net/wang465745776/article/details/52212871





猜你喜欢

转载自blog.csdn.net/t3369/article/details/79868224