You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Alex Worden <al...@gmail.com> on 2007/08/24 20:46:49 UTC

Getting the source code for a dependency

Hi,

Please can someone tell me if there is a way to ask Maven 2 to download the
source code for a dependency... and if so, where will it put it? Also it
would be useful to know if there is any definitive way to determine which
dependency a referenced class comes from. For instance, I'm looking for the
documentation on of:

org.springframework.transaction.annotation.Transactional

so I can read what the @Transactional annotation means

My guess is that it is downloaded in the pom.xml config section:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>2.0.1</version>
            <scope>test</scope>
        </dependency>

but.. there is no way of determining this. I can only guess that I have to
use a utility to trawl through all the jars in the .m2/repository to find
this class.

That aside... my main question is this: Is there some xml element I can add
to <dependency> that will download the source code for this version of the
JAR?

Many thanks,

Alex

Re: Getting the source code for a dependency

Posted by Dave Feltenberger <da...@gmail.com>.
Hi Alex,

I know if you use the Eclipse plugin, you can put this in your parent pom:
...
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
        </plugins>
...

And then run "mvn eclipse:eclipse"  (or don't add the plugin tag, and run
"mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true").
Then you'll be able to see the source for those that can be found.

Dave

On 8/24/07, Alex Worden <al...@gmail.com> wrote:
>
> Hi,
>
> Please can someone tell me if there is a way to ask Maven 2 to download
> the
> source code for a dependency... and if so, where will it put it? Also it
> would be useful to know if there is any definitive way to determine which
> dependency a referenced class comes from. For instance, I'm looking for
> the
> documentation on of:
>
> org.springframework.transaction.annotation.Transactional
>
> so I can read what the @Transactional annotation means
>
> My guess is that it is downloaded in the pom.xml config section:
>
>         <dependency>
>             <groupId>org.springframework</groupId>
>             <artifactId>spring-core</artifactId>
>             <version>2.0.1</version>
>             <scope>test</scope>
>         </dependency>
>
> but.. there is no way of determining this. I can only guess that I have to
> use a utility to trawl through all the jars in the .m2/repository to find
> this class.
>
> That aside... my main question is this: Is there some xml element I can
> add
> to <dependency> that will download the source code for this version of the
> JAR?
>
> Many thanks,
>
> Alex
>