关于maven打源码包的有关问题

关于maven打源码包的问题
自己写了一个公共的模块,以jar包形式被其他项目依赖,因为想在其他项目中可以直接看此模块的源码,于是开始尝试将源码也打包放到本地maven仓库中。

一开始,我在命令行输入:
mvn source:jar
但是这个命令只是打了一个源码包放到了target下,可本地仓库中并没有
想到maven打包并安装到本地仓库用的是install,于是输入命令:
mvn install
虽然target下已经有了com.xxx.project-1.0-sources.jar,但仍然没有安装源码包到本地仓库
于是到maven官网看install的用法,install有三个goal

install:install is used to automatically install the project's main artifact (the JAR, WAR or EAR), its POM and any attached artifacts (sources, javadoc, etc) produced by a particular project.
install:install-file is mostly used to install an externally created artifact into the local repository, along with its POM. In that case the project information can be taken from an optionally specified pomFile, but can also be given using command line parameters.
install:help displays help information on maven-install-plugin.


用第二个goal,输入:
mvn install:install-file -file=target/com.xxx.project-1.0-sources.jar -DgroupId=com.xxx -DartifactId=project -Dversion=1.0 -Dclassifier=sources
成功了
但是,
如果打个源码包要这么麻烦的话,还不如自己打包-改名-放到本地仓库的对应目录中
难道用第一个goal就不到达到目的吗?maven-install-plugin会这么傻吗?
第一个goal中有这样一句:its POM and any attached artifacts(sources, javadoc, etc)
但是我不知道install插件是怎么样去认定attached artifacts

当我想尝试将清理、打源码包、安装到本地仓库用一行命令进行时,我发现这时候:源码包被安装进本地仓库了
mvn clean source:jar install
最后问题终于解决了,看来所谓attached artifacts指的是在同一次生命周期中参加的sources或javadoc生命周期