user1413969
user1413969

Reputation: 1301

Creating a jar with source attachment.

Right now I want to create a jar file of my project that comes with it's source attachment. This means that when I import the jar into eclipse and then when I click to view the jar, I don't want a source not found message.

I've created my jar via eclipse and I checked the box that said "Export java source files and resources", which allows me to view the source files from within my far, but Eclipse is still asking for the location of the source.

Can I possibly create a JAR and import that JAR to eclipse without getting a source not found message?

Upvotes: 2

Views: 96

Answers (2)

jfcorugedo
jfcorugedo

Reputation: 10059

You can generate the source without inserting this plugin in your pom, just executing this command:

mvn source:jar

If you want to move the sources JAR to your local repo, you must execute:

mvn source:jar install

Upvotes: 0

MariuszS
MariuszS

Reputation: 31595

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <executions>
        <execution>
            <id>attach-sources</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Upvotes: 3

Related Questions