简体   繁体   English

可以将源代码和javadoc jar安装到maven存储库,以及单个命令`mvn clean all`。

[英]is is possible to install the source and javadoc jar to maven repository along with a single command `mvn clean all`

As we all know that using mvn clean install will install the built package,eg jar, zip, pom, to local repo , but source and javadoc jar . 众所周知,使用mvn clean install将安装的软件包(例如jar,zip,pom)安装到本地repo,但将源和javadoc jar安装到本地。 Can I make some changes on pom.xml so that source and jardoc jar would be installed to local repo with mvn clean install 我可以对pom.xml进行一些更改,以便使用mvn clean install将源和jardoc jar安装到本地存储库中

Yes, what you want to do is to add the maven-source-plugin and maven-javadoc-plugin to your pom. 是的,您要做的是将maven-source-plugin和maven-javadoc-plugin添加到pom中。 This will cause the jar goal to execute automatically during the package phase without needing to specify it on the command line. 这将导致jar目标在打包阶段自动执行,而无需在命令行上指定它。

<plugins>
    <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>
    ...
<plugins>

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

相关问题 Maven:让“mvn -Pjenkins”与“mvn clean install pmd:pmd javadoc:aggregate”相同 - Maven: Let “mvn -Pjenkins” be the same as “mvn clean install pmd:pmd javadoc:aggregate” 如何将jar,source和Javadoc添加到本地Maven存储库? - How to add a jar, source and Javadoc to the local Maven repository? 什么是maven命令“ mvn clean install -e”? - What maven command “mvn clean install -e” does? -d在maven命令中指示:mvn clean install -DskipTests - what does -D indicates in maven command: mvn clean install -DskipTests 使用 ansible 模块运行“mvn clean install”maven 命令 - Running "mvn clean install" maven command using ansible module maven clean install等于mvn clean并在mvn安装后? - Maven clean install is equal mvn clean and after mvn install? Maven Shade 插件:“mvn install”如何在本地存储库中包含通过“mvn package”生成的相同 jar? - Maven Shade Plugin: how 'mvn install' can include in the local repository the same jar generated through 'mvn package'? maven clean install不从本地存储库中获取jar - maven clean install not taking jar from local repository <maven>命令“mvn dependency:resolve”与“mvn clean install”有何不同?</maven> - <Maven> How is the command "mvn dependency:resolve" different from "mvn clean install"? Maven 干净安装 / jar:jar - Maven clean install / jar:jar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM