简体   繁体   English

带有maven-source-plugin的maven-jar-plugin不起作用

[英]maven-jar-plugin with maven-source-plugin not working

I'm using maven-jar-plugin to create JAR with my test class as below: 我正在使用maven-jar-plugin用我的测试类创建JAR,如下所示:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <executions>
            <execution>
                <goals>
                    <goal>test-jar</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

I want to add source code to test JAR using maven-source-plugin like that: 我想添加源代码使用maven-source-plugin来测试JAR,如下所示:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${maven-source.version}</version>
        <executions>
            <execution>
                <id>attach-sources</id>
                <goals>
                    <goal>jar</goal>
                </goals>
            </execution>
            <execution>
                <id>attach-test-sources</id>
                <goals>
                    <goal>test-jar</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

As results I got four JAR files: 结果,我得到了四个JAR文件:

<name>.jar
<name>-sources.jar
<name>-tests.jar
<name>-test-sources.jar

My question is what I do wrong that I can't download sources for test's classes but can do that for main classes? 我的问题是我做错了什么,我不能为测试的类下载源代码,但可以为主要的类下载源代码?

Regards 问候

<name>-tests.jar is not a misspelling, see Apache Maven JAR Plugin / jar:test-jar : <name>-tests.jar并非拼写错误,请参阅Apache Maven JAR插件/ jar:test-jar

<classifier> Classifier to used for test-jar . <classifier>用于test-jar分类器。 Default value is: tests . 默认值为: tests

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM