Short answer: because maven does not guarantee the execution order within a phase. Long answer:
maven-install-plugin:install installs all the artifacts that are attached to the current module in the current build reactor into the local repository. maven-javadoc-plugin:jar creates a jar of the module javadocs and attaches it to the current module. the same applies to test-jar... when install:install runs *before* javadoc:jar, the javadoc jar is not attached, and so cannot be installed. the solution is to bind the javadoc executions to a phase *before* install in order to guarantee that the artifacts are available. FYI, the preferred phase to bind artifact creation to is the "package" phase. There is nothing stopping you from binding to a different phase, but you will find that "things just work" if you bind "packaging up my artifacts" to the package phase -Stephen 2009/4/23 nodje <[email protected]>: > > hmmm, maybe I should reformulate in something simpler. > Hope someone that understand source and javadoc plugins is gonna pity > me:wistle: > > Basically, I expect from both source and javadoc plugin, to create the > source and javadoc jars. > Then, when invoking install or deploy, I expect all artifacts, including > -sources.jar and -javadoc.jar, to de installed locally, then deployed when > deploy is invoked. > > This totally works when including the plugins in the regular > <build><plugins><plugin> > It does as well if I include plugins in some > <profiles><profile><build><plugins><plugin>, when the plugin is active. > > But it does not if I modify the standard way of execution with: > <execution> > <phase>install</phase> > <goals> > <goal>jar</goal> > <goal>test-jar</goal> > </goals> > </execution> > In this case, the source and javadoc artifacts are created, but they won't > be installed in the local repo nor will they be deployed. > > Why is that? > > -nodje > > > nodje wrote: >> >> Hi, >> >> I'm trying to limit the creation of Sources and Javadoc jars to goals only >> after install. >> >> Currently, these two are triggered with profiles (the one for PROD >> deployment) and it works well. >> >> I'd like to have those also created for internal deployment when we don't >> use the PROD profile. >> >> Having the two plugins linked to the install phase for that purpose seemed >> good to me: >> >> <plugin> >> <artifactId>maven-source-plugin</artifactId> >> <version>2.0.4</version> >> <executions> >> <execution> >> <phase>install</phase> >> <goals> >> <goal>jar</goal> >> <goal>test-jar</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> <plugin> >> <artifactId>maven-javadoc-plugin</artifactId> >> <version>2.5</version> >> <configuration> >> <quiet>true</quiet> >> </configuration> >> <executions> >> <execution> >> <id>attach-javadocs</id> >> <phase>deploy</phase> >> <goals> >> <goal>jar</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> >> and it works to some extends. The articfacts are created (-sources-jar, >> -javadoc.jar) as expected when invoking the install goal. >> But they aren't copied to the local repository anymore. (though the >> sources artifacts are when invoking the deploy goal with this config.) >> >> NB: when invoking 'deploy' goal: if Javadoc plugin is linked to deploy >> phase, javadoc artifact doesn't get copied nor uploaded to local and >> remote repos. If linked to the install phase like for the Source plugin, >> javadoc artifact do get copied and then uploaded. >> >> Why is that? >> >> I have a hard time understanding why they get copied when the plugin >> <execution> section doesn't contain any phase attribute, or when the >> plugin belongs to a Profile and NOT when the <phase>install</phase> is >> included in the plugin. >> >> -nodje >> > > -- > View this message in context: > http://n2.nabble.com/Linking-source---javadoc-plugin-to-install-phase---limitation--tp2626903p2681088.html > Sent from the maven users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
