Thursday, April 4, 2013

Installing application sources jar to local maven repo.

I've been searching for a way to install my own application sources to my local maven repo along with the jar file, but couldn't found any where and not even in maven site.

But finally I got a way to do it when I was analyzing the maven plugins. Here it goes, just have this entry in ur pom.xml!!

<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>

Fun to be coding!