Java 打包源代码和依赖项

Java 打包源代码和依赖项,java,maven,Java,Maven,我正在尝试使用Maven构建一个jar包,其中包含源代码和所有依赖项。问题是Maven没有打包源代码,只是打包依赖项 我是否也需要设置一个配置来打包源代码 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ht

我正在尝试使用Maven构建一个jar包,其中包含源代码和所有依赖项。问题是Maven没有打包源代码,只是打包依赖项

我是否也需要设置一个配置来打包源代码

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>courier-perf-test</groupId>
    <artifactId>courier-perf-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>ze.delivery.HTTPRequestClass</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

    </dependencies>
</project>

4.0.0
信使性能测试
信使性能测试
0.0.1-快照
maven汇编插件
ze.delivery.HTTPRequestClass
带有依赖项的jar
组装
包裹
单一的
com.googlecode.json-simple
简单json
1.1.1

使用src作为程序集插件配置中的描述符ref,为项目创建源存档,或者最好使用预定义的描述符
项目

<descriptorRefs>
   <descriptorRef>jar-with-dependencies</descriptorRef>
   <descriptorRef>src</descriptorRef>
</descriptorRefs>

带有依赖项的jar
src
或:


带有依赖项的jar
项目
参考:

<descriptorRefs>
   <descriptorRef>jar-with-dependencies</descriptorRef>
   <descriptorRef>project</descriptorRef>
</descriptorRefs>