views:

43

answers:

2

Suppose I do have maven 2 java project in my local machine, when I'm doing mvn install, I'm build project jar and push it to my local maven repo, how can I force maven to push to local repo project sources jar also? This is useful if I'll use above mentioned project as dependency while developing new project, and can use mvn eclipse:eclipse -DdownloadSources feature.

Thanks.

A: 

Have you try maven release plugin?

Javabeginner
release? for the local repository? I don't think so...
seanizer
+2  A: 

This snippet automatically installs / deploys a source jar from any install / deploy:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>
seanizer
wow, it so simple! was hard to find this on maven site, thanks!
abovesun