使用maven-source-plugin在mvn包之后没有生成maven sources.jar文件

时间:2016-05-06 09:21:45

标签: java maven

我正在尝试使用maven-source-plugin为我的项目生成sources.jar文件。这是我的pom.xml的相关部分

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <annotationProcessors>
                    <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
                    </annotationProcessor>
                    <annotationProcessor>org.mapstruct.ap.MappingProcessor</annotationProcessor>
                </annotationProcessors>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>jar</goal>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <excludes>
                    <exclude>application.properties</exclude>
                </excludes>
                <archive>
                    <manifest>
                        <addClasspath>false</addClasspath>
                        <mainClass>com.company.application.Application</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </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>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.6.201602180812</version>
            <configuration>
                <append>true</append>
                <excludes>
                    <exclude>**/backend/**/*.*</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <id>agent-for-ut</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>agent-for-it</id>
                    <goals>
                        <goal>prepare-agent-integration</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jacoco-site</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</pluginManagement>

我正在关注此link,当我运行mvn package时,我在maven存储库中看不到任何xxx-sources.jar文件。

以下是mvn package

的输出
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building  App - Core 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ plmapp-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ plmapp-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 131 source files to C:\Users\taaupsa1\GitWS\plmapp-core\target\classes
[INFO] /C:/Users/taaupsa1/GitWS/plmapp-core/src/main/java/com/plm/core/factory/NeoConnectionFactory.java: C:\Users\taaupsa1\GitWS\plmapp-core\src\main\java\com\plm\core\factory\NeoConnectionFactory.java uses or overrides a deprecated API.
[INFO] /C:/Users/taaupsa1/GitWS/plmapp-core/src/main/java/com/plm/core/factory/NeoConnectionFactory.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/Users/taaupsa1/GitWS/plmapp-core/src/main/java/com/plm/core/model/PlmCSV.java: C:\Users\taaupsa1\GitWS\plmapp-core\src\main\java\com\plm\core\model\PlmCSV.java uses unchecked or unsafe operations.
[INFO] /C:/Users/taaupsa1/GitWS/plmapp-core/src/main/java/com/plm/core/model/PlmCSV.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ plmapp-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ plmapp-core ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ plmapp-core ---
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ plmapp-core ---
[INFO] Building jar: C:\Users\taaupsa1\GitWS\plmapp-core\target\plmapp-core.jar
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default) @ plmapp-core ---
[INFO] 
[INFO] --- maven-jar-plugin:2.6:test-jar (default) @ plmapp-core ---
[INFO] Building jar: C:\Users\taaupsa1\GitWS\plmapp-core\target\plmapp-core-tests.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.282 s
[INFO] Finished at: 2016-05-06T11:15:56+02:00
[INFO] Final Memory: 33M/441M
[INFO] ------------------------------------------------------------------------
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes\jasmine.jar"

Process finished with exit code 0

我在这里做错了什么?

0 个答案:

没有答案