You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by siegfried <si...@heintze.com> on 2007/12/21 19:11:33 UTC

How to single step with debugger thru java spring-framework source code with Eclipse and maven?

 

I'm having trouble telling eclipse where the source code is for spring for a
java project.

 

I have used maven to download spring for me. I want to use the eclipse java
debugger to single thu source for
org.springframework.jdbc.object.MappingSqlQuery. I 

high light the class name and press F3 in eclipse. Now eclipse cannot find
the source code. But there is a button to press that brings up a dialog box
that allows me to specify a source code directory. How do I tell which
version of spring 

that maven downloaded on behalf of eclipse? Below is my pom.xml.

 

So as I was saying: now I see the eclipse dialog entitled "Class File
Editor" with a button to attach the source code for 

spring 2.5 that I have manually unpacked. Woops, the eclipse debugger is
working and single stepping thru the spring source. Hurray!

 

Oh wait! There is a problem: I must have the wrong version of the source
code because I'm 

single stepping thru comments so the source must not match the class files. 

How do I fix that?

 

How to I make maven download and use the latest version of spring (which I
think is 2.5)?

 

Thanks,

Siegfried

 

 

<?xml version="1.0" encoding="UTF-8"?>

<project>

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.springinaction</groupId>

  <artifactId>sia</artifactId>

  <version>2.0</version>

  <packaging>pom</packaging>

  <name>Spring in Action 2E, Examples</name>

  <url>http://www.springframework.org/osgi</url>

 

  <properties>

    <spring.version>2.0.6</spring.version>

  </properties>

 

  <dependencies>

    <dependency>

      <groupId>org.springframework</groupId>

      <artifactId>spring</artifactId>

      <version>${spring.version}</version>

      <scope>compile</scope>

    </dependency>

    <dependency>

      <groupId>log4j</groupId>

      <artifactId>log4j</artifactId>

      <version>1.2.13</version>

      <scope>compile</scope>

    </dependency>

    <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>3.8.1</version>

      <scope>test</scope>

    </dependency>

    <dependency>

      <groupId>junit-addons</groupId>

      <artifactId>junit-addons</artifactId>

      <version>1.4</version>

      <scope>test</scope>

    </dependency>

  </dependencies>

 

  <modules>

    <module>Chapter01</module>

    <module>Chapter02</module>

    <module>Chapter03</module>

    <module>Chapter04</module>

    <module>Chapter09</module>

    <module>Chapter16</module>

    <module>RoadRantz</module>

  </modules>

</project> 

 


Re: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "nicolas de loof" <ni...@apache.org>:

> You can also set this in you $HOME/.m2/settings.xml
>  <properties>
>     <downloadSources>true</downloadSources>
>  </properties>

> so that you don't have to set -D... everytime you launch eclipse:eclipse

I actually prefer to control it with the command line, since using this
flag can take a long time on a multi-project invocation, if it can't
find source jars for some jars in the classpath.

I usually run it with this flag once initially.  Then I run it again if
I see that I miss some source during debugging.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by nicolas de loof <ni...@apache.org>.
You can also set this in you $HOME/.m2/settings.xml

 <properties>
    <downloadSources>true</downloadSources>
 </properties>

so that you don't have to set -D... everytime you launch eclipse:eclipse

2007/12/24, Steinar Bang <sb...@dod.no>:
>
> >>>>> "Jeff MAURY" <je...@jeffmaury.com>:
>
> > I you use the maven eclipse plugin, there is an option in the
> > preference that tells maven to download source artifact as well as
> > binary artifact.  Once you've checked this flag, when Eclipse buids
> > the classpath from you pom, the source artifact will automatically be
> > attached to the referenced jar.
>
> The invocation is
> mvn eclipse:eclipse -DdownloadSources=true
>
> Here are the docs:
> http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html
>
> What "mvn eclipse:eclipse" does is to create .project and .classpath
> files (as well as some other eclipse stuff), in all projects with
> packaging jar, and others it knows about that are eclipse relevant.
>
> When invoked over a multi-project it, by default, creates project
> dependencies between the projects it generates eclipse files for.  For
> projects outside of the invocation, and jar dependencies, it creates
> .classpath references into the local maven repo.
>
> If it finds source-jars together with the jars in the local maven repo,
> it will add them to its sources.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Jeff MAURY" <je...@jeffmaury.com>:

> I you use the maven eclipse plugin, there is an option in the
> preference that tells maven to download source artifact as well as
> binary artifact.  Once you've checked this flag, when Eclipse buids
> the classpath from you pom, the source artifact will automatically be
> attached to the referenced jar.

The invocation is
 mvn eclipse:eclipse -DdownloadSources=true

Here are the docs:
 http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html

What "mvn eclipse:eclipse" does is to create .project and .classpath
files (as well as some other eclipse stuff), in all projects with
packaging jar, and others it knows about that are eclipse relevant.

When invoked over a multi-project it, by default, creates project
dependencies between the projects it generates eclipse files for.  For
projects outside of the invocation, and jar dependencies, it creates
.classpath references into the local maven repo.

If it finds source-jars together with the jars in the local maven repo,
it will add them to its sources.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by Jeff MAURY <je...@jeffmaury.com>.
I you use the maven eclipse plugin, there is an option in the preference
that tells maven to download source artifact as well as binary artifact.
Once you've checked this flag, when Eclipse buids the classpath from you
pom, the source artifact will automatically be attached to the referenced
jar.

Regards
Jeff


On Dec 21, 2007 9:23 PM, siegfried <si...@heintze.com> wrote:

> Wow! Thanks for that prompt response! What a joy!
>
> OK, I'm poking around in C:\Documents and
> Settings\siegfried\.m2\org\springframework\spring\2.0.6.
>
> I notice there are quite a few different versions and 2.0.6 is the latest.
> Can I assume my project is using the latest? What command do I have to
> give
> eclipse or maven to check for newer versions of spring?
>
> Anyway, I expanded c:\\Documents and
> Settings\\siegfried\\.m2\\org\\springframework\\spring\\2.0.6\\spring-
> 2.0.6.
> jar and while I see springframework/jdbc/object/MappingSqlQuery.class I
> don't see any java source files.
>
> Do I have to edit my pom.xml to make it include the source? Is there a
> flag
> or is it just another dependency I can add with the eclipse maven IDE?
>
> Thanks,
> Siegfried
>
> -----Original Message-----
> From: Guillaume Lederrey [mailto:guillaume.lederrey@gmail.com]
> Sent: Friday, December 21, 2007 11:21 AM
> To: Maven Users List
> Subject: Re: How to single step with debugger thru java spring-framework
> source code with Eclipse and maven?
>
> Maven should have downloaded the sources in your maven repository. So
> you could point eclipse to the jars there.
>
> On 21/12/2007, siegfried <si...@heintze.com> wrote:
> >
> >
> > I'm having trouble telling eclipse where the source code is for spring
> for
> a
> > java project.
> >
> >
> >
> > I have used maven to download spring for me. I want to use the eclipse
> java
> > debugger to single thu source for
> > org.springframework.jdbc.object.MappingSqlQuery. I
> >
> > high light the class name and press F3 in eclipse. Now eclipse cannot
> find
> > the source code. But there is a button to press that brings up a dialog
> box
> > that allows me to specify a source code directory. How do I tell which
> > version of spring
> >
> > that maven downloaded on behalf of eclipse? Below is my pom.xml.
> >
> >
> >
> > So as I was saying: now I see the eclipse dialog entitled "Class File
> > Editor" with a button to attach the source code for
> >
> > spring 2.5 that I have manually unpacked. Woops, the eclipse debugger is
> > working and single stepping thru the spring source. Hurray!
> >
> >
> >
> > Oh wait! There is a problem: I must have the wrong version of the source
> > code because I'm
> >
> > single stepping thru comments so the source must not match the class
> files.
> >
> > How do I fix that?
> >
> >
> >
> > How to I make maven download and use the latest version of spring (which
> I
> > think is 2.5)?
> >
> >
> >
> > Thanks,
> >
> > Siegfried
> >
> >
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <project>
> >
> >   <modelVersion>4.0.0</modelVersion>
> >
> >   <groupId>com.springinaction</groupId>
> >
> >   <artifactId>sia</artifactId>
> >
> >   <version>2.0</version>
> >
> >   <packaging>pom</packaging>
> >
> >   <name>Spring in Action 2E, Examples</name>
> >
> >   <url>http://www.springframework.org/osgi</url>
> >
> >
> >
> >   <properties>
> >
> >     <spring.version>2.0.6</spring.version>
> >
> >   </properties>
> >
> >
> >
> >   <dependencies>
> >
> >     <dependency>
> >
> >       <groupId>org.springframework</groupId>
> >
> >       <artifactId>spring</artifactId>
> >
> >       <version>${spring.version}</version>
> >
> >       <scope>compile</scope>
> >
> >     </dependency>
> >
> >     <dependency>
> >
> >       <groupId>log4j</groupId>
> >
> >       <artifactId>log4j</artifactId>
> >
> >       <version>1.2.13</version>
> >
> >       <scope>compile</scope>
> >
> >     </dependency>
> >
> >     <dependency>
> >
> >       <groupId>junit</groupId>
> >
> >       <artifactId>junit</artifactId>
> >
> >       <version>3.8.1</version>
> >
> >       <scope>test</scope>
> >
> >     </dependency>
> >
> >     <dependency>
> >
> >       <groupId>junit-addons</groupId>
> >
> >       <artifactId>junit-addons</artifactId>
> >
> >       <version>1.4</version>
> >
> >       <scope>test</scope>
> >
> >     </dependency>
> >
> >   </dependencies>
> >
> >
> >
> >   <modules>
> >
> >     <module>Chapter01</module>
> >
> >     <module>Chapter02</module>
> >
> >     <module>Chapter03</module>
> >
> >     <module>Chapter04</module>
> >
> >     <module>Chapter09</module>
> >
> >     <module>Chapter16</module>
> >
> >     <module>RoadRantz</module>
> >
> >   </modules>
> >
> > </project>
> >
> >
> >
> >
>
>
> --
> Jabber : gehel@amessage.ch
> Skype : Guillaume.Lederrey
> Projects :
> * http://rwanda.wordpress.com/
> * http://rwandatech.wordpress.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

RE: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by siegfried <si...@heintze.com>.
Wow! Thanks for that prompt response! What a joy!

OK, I'm poking around in C:\Documents and
Settings\siegfried\.m2\org\springframework\spring\2.0.6.

I notice there are quite a few different versions and 2.0.6 is the latest.
Can I assume my project is using the latest? What command do I have to give
eclipse or maven to check for newer versions of spring?

Anyway, I expanded c:\\Documents and
Settings\\siegfried\\.m2\\org\\springframework\\spring\\2.0.6\\spring-2.0.6.
jar and while I see springframework/jdbc/object/MappingSqlQuery.class I
don't see any java source files.

Do I have to edit my pom.xml to make it include the source? Is there a flag
or is it just another dependency I can add with the eclipse maven IDE?

Thanks,
Siegfried

-----Original Message-----
From: Guillaume Lederrey [mailto:guillaume.lederrey@gmail.com] 
Sent: Friday, December 21, 2007 11:21 AM
To: Maven Users List
Subject: Re: How to single step with debugger thru java spring-framework
source code with Eclipse and maven?

Maven should have downloaded the sources in your maven repository. So
you could point eclipse to the jars there.

On 21/12/2007, siegfried <si...@heintze.com> wrote:
>
>
> I'm having trouble telling eclipse where the source code is for spring for
a
> java project.
>
>
>
> I have used maven to download spring for me. I want to use the eclipse
java
> debugger to single thu source for
> org.springframework.jdbc.object.MappingSqlQuery. I
>
> high light the class name and press F3 in eclipse. Now eclipse cannot find
> the source code. But there is a button to press that brings up a dialog
box
> that allows me to specify a source code directory. How do I tell which
> version of spring
>
> that maven downloaded on behalf of eclipse? Below is my pom.xml.
>
>
>
> So as I was saying: now I see the eclipse dialog entitled "Class File
> Editor" with a button to attach the source code for
>
> spring 2.5 that I have manually unpacked. Woops, the eclipse debugger is
> working and single stepping thru the spring source. Hurray!
>
>
>
> Oh wait! There is a problem: I must have the wrong version of the source
> code because I'm
>
> single stepping thru comments so the source must not match the class
files.
>
> How do I fix that?
>
>
>
> How to I make maven download and use the latest version of spring (which I
> think is 2.5)?
>
>
>
> Thanks,
>
> Siegfried
>
>
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <project>
>
>   <modelVersion>4.0.0</modelVersion>
>
>   <groupId>com.springinaction</groupId>
>
>   <artifactId>sia</artifactId>
>
>   <version>2.0</version>
>
>   <packaging>pom</packaging>
>
>   <name>Spring in Action 2E, Examples</name>
>
>   <url>http://www.springframework.org/osgi</url>
>
>
>
>   <properties>
>
>     <spring.version>2.0.6</spring.version>
>
>   </properties>
>
>
>
>   <dependencies>
>
>     <dependency>
>
>       <groupId>org.springframework</groupId>
>
>       <artifactId>spring</artifactId>
>
>       <version>${spring.version}</version>
>
>       <scope>compile</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>log4j</groupId>
>
>       <artifactId>log4j</artifactId>
>
>       <version>1.2.13</version>
>
>       <scope>compile</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>junit</groupId>
>
>       <artifactId>junit</artifactId>
>
>       <version>3.8.1</version>
>
>       <scope>test</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>junit-addons</groupId>
>
>       <artifactId>junit-addons</artifactId>
>
>       <version>1.4</version>
>
>       <scope>test</scope>
>
>     </dependency>
>
>   </dependencies>
>
>
>
>   <modules>
>
>     <module>Chapter01</module>
>
>     <module>Chapter02</module>
>
>     <module>Chapter03</module>
>
>     <module>Chapter04</module>
>
>     <module>Chapter09</module>
>
>     <module>Chapter16</module>
>
>     <module>RoadRantz</module>
>
>   </modules>
>
> </project>
>
>
>
>


-- 
Jabber : gehel@amessage.ch
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.wordpress.com/
* http://rwandatech.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to single step with debugger thru java spring-framework source code with Eclipse and maven?

Posted by Guillaume Lederrey <gu...@gmail.com>.
Maven should have downloaded the sources in your maven repository. So
you could point eclipse to the jars there.

On 21/12/2007, siegfried <si...@heintze.com> wrote:
>
>
> I'm having trouble telling eclipse where the source code is for spring for a
> java project.
>
>
>
> I have used maven to download spring for me. I want to use the eclipse java
> debugger to single thu source for
> org.springframework.jdbc.object.MappingSqlQuery. I
>
> high light the class name and press F3 in eclipse. Now eclipse cannot find
> the source code. But there is a button to press that brings up a dialog box
> that allows me to specify a source code directory. How do I tell which
> version of spring
>
> that maven downloaded on behalf of eclipse? Below is my pom.xml.
>
>
>
> So as I was saying: now I see the eclipse dialog entitled "Class File
> Editor" with a button to attach the source code for
>
> spring 2.5 that I have manually unpacked. Woops, the eclipse debugger is
> working and single stepping thru the spring source. Hurray!
>
>
>
> Oh wait! There is a problem: I must have the wrong version of the source
> code because I'm
>
> single stepping thru comments so the source must not match the class files.
>
> How do I fix that?
>
>
>
> How to I make maven download and use the latest version of spring (which I
> think is 2.5)?
>
>
>
> Thanks,
>
> Siegfried
>
>
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <project>
>
>   <modelVersion>4.0.0</modelVersion>
>
>   <groupId>com.springinaction</groupId>
>
>   <artifactId>sia</artifactId>
>
>   <version>2.0</version>
>
>   <packaging>pom</packaging>
>
>   <name>Spring in Action 2E, Examples</name>
>
>   <url>http://www.springframework.org/osgi</url>
>
>
>
>   <properties>
>
>     <spring.version>2.0.6</spring.version>
>
>   </properties>
>
>
>
>   <dependencies>
>
>     <dependency>
>
>       <groupId>org.springframework</groupId>
>
>       <artifactId>spring</artifactId>
>
>       <version>${spring.version}</version>
>
>       <scope>compile</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>log4j</groupId>
>
>       <artifactId>log4j</artifactId>
>
>       <version>1.2.13</version>
>
>       <scope>compile</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>junit</groupId>
>
>       <artifactId>junit</artifactId>
>
>       <version>3.8.1</version>
>
>       <scope>test</scope>
>
>     </dependency>
>
>     <dependency>
>
>       <groupId>junit-addons</groupId>
>
>       <artifactId>junit-addons</artifactId>
>
>       <version>1.4</version>
>
>       <scope>test</scope>
>
>     </dependency>
>
>   </dependencies>
>
>
>
>   <modules>
>
>     <module>Chapter01</module>
>
>     <module>Chapter02</module>
>
>     <module>Chapter03</module>
>
>     <module>Chapter04</module>
>
>     <module>Chapter09</module>
>
>     <module>Chapter16</module>
>
>     <module>RoadRantz</module>
>
>   </modules>
>
> </project>
>
>
>
>


-- 
Jabber : gehel@amessage.ch
Skype : Guillaume.Lederrey
Projects :
* http://rwanda.wordpress.com/
* http://rwandatech.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org