Issue Details (XML | Word | Printable)

Key: MSOURCES-11
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jason van Zyl
Reporter: Aaron Digulla
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 2.x Source Plugin

When source plugin is used, it should make sure it is invoked during install

Created: 06/Nov/06 10:41 AM   Updated: 07/Aug/07 07:22 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.3

Time Tracking:
Not Specified


 Description  « Hide
I have a really hard time to make the source plugin work. When I just run "mvn install", the source plugin is ignored.

I tried to use executions (http://garbuz.com/sm/content.php/articles/maven2_deploying_sources/) but that also doesn't work reliably.

The only stable way I found so far is:

mvn source:jar install

but that's tedious. Isn't it possible to configure the plugin by default in such a way that, when it is used in the POM, it will be invoked automatically during "mvn install", "mvn deploy", etc?



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Aaron Digulla added a comment - 06/Nov/06 10:43 AM
Oh, I'm using Maven 2.0.4 and the source plugin is 2.0.1.

Aaron Digulla added a comment - 22/Nov/06 06:34 AM
Note: The executions (see link above) only work if they are in the POM of every module of your project.

Just defining this once in the parent pom doesn't work.


Jason van Zyl added a comment - 13/Jan/07 09:28 PM
Using the following will get you what you want. I will update the documentation with this example.

<project>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<aggregate>false</aggregate>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
</project>



Jason van Zyl added a comment - 13/Jan/07 09:35 PM
This works just fine.

Aaron Digulla added a comment - 14/Jan/07 05:16 AM
Have you tried this using a parent POM?

Ie. move this code to the parent pom and then try to build the child project. You won't get a source JAR.

Also, it would be great if the source plugin would attach itself to the package phase automatically because when I use, why would I want it to run at any other time? The default should be what most users want.


Christian Sauer added a comment - 07/Aug/07 07:22 AM
Hey,

may it be possible that this issue is still present in 2.0.6?
I' ve got a parent POM with following plugin config:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>

Building a component with a pom inheriting from the parent one, the build will still not create the source artifact!
I have to add the definition to each component for the sources jar being created ...
Any idea?

Cheers