Maven 项目打包源文件 *-sources.jar

在 pom.xml 配置文件中添加以下插件:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-source-pluginartifactId>
                <version>2.4version>
                <executions>
                    <execution>
                        <id>attach-sourcesid>
                        <phase>verifyphase>
                        <goals>
                            <goal>jar-no-forkgoal>
                        goals>
                    execution>
                executions>
            plugin>
        plugins>
    build>

然后执行打包命令:

mvn clean install

你可能感兴趣的:(工作问题,maven,打包,源文件,插件,sources)