With the following configuration sources will be created in target folder with
mvn install and deployed to local repo with
mvn deploy. It is probably not possible to link this to the deploy phase.
<plugin> <!-- mvn install creates source jars, mvn deploy deploys them to central repo --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <configuration> <attach>true</attach> </configuration> <executions> <execution> <phase>install</phase> <goals> <goal>jar</goal> <goal>test-jar</goal> </goals> </execution> </executions> </plugin>