You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Mike Edwards <mi...@gmail.com> on 2009/04/22 17:57:11 UTC

Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Folks,

I ran a full build against Tuscany 2.0 after doing svn update earlier today - and then executed  mvn 
-Peclipse against the result.

The generated  .classpath files for the Eclipse projects all contained this entry:

<classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>


I didn't used to get these entries in previous builds - and they screw my Eclipse system, which is 
universally using JDK 6.x.

Any idea why these entries are turning up - and more importantly, how to get rid of them?


Yours,  Mike.

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Mike Edwards <mi...@gmail.com>.
Luciano Resende wrote:
> On Wed, Apr 22, 2009 at 10:41 AM, Raymond Feng <en...@gmail.com> wrote:
>> Reading through the maven-eclipse-plugin code, it tries to detect the JRE
>> setting from the workspace. How do you place the tuscany source code and
>> your Eclipse workspace?
>>
> 
> Maybe the eclipse is still setup to use 1.5 JRE ? Check in
> preferences->java->jre
> 
> 
It's definitely not that.  My Eclipse only has JRE = 1.6.0_07 and nothing else.

Also, the default JRE on my system is 1.6.0_07 (ie that is what you get if you type "java" on the 
command line).


Yours,  Mike.

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Luciano Resende <lu...@gmail.com>.
On Wed, Apr 22, 2009 at 10:41 AM, Raymond Feng <en...@gmail.com> wrote:
> Reading through the maven-eclipse-plugin code, it tries to detect the JRE
> setting from the workspace. How do you place the tuscany source code and
> your Eclipse workspace?
>

Maybe the eclipse is still setup to use 1.5 JRE ? Check in
preferences->java->jre


-- 
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Raymond Feng <en...@gmail.com>.
Reading through the maven-eclipse-plugin code, it tries to detect the JRE 
setting from the workspace. How do you place the tuscany source code and 
your Eclipse workspace?

Please try to run mvn -Peclipse -X against one module. Post the output here. 
I might be able to figure out something.

Thanks,
Raymond
--------------------------------------------------
From: "Mike Edwards" <mi...@gmail.com>
Sent: Wednesday, April 22, 2009 8:57 AM
To: <de...@tuscany.apache.org>
Subject: Unexpected entries in .classpath files when running mvn -Peclipse - 
HELP PLEASE

> Folks,
>
> I ran a full build against Tuscany 2.0 after doing svn update earlier 
> today - and then executed  mvn -Peclipse against the result.
>
> The generated  .classpath files for the Eclipse projects all contained 
> this entry:
>
> <classpathentry kind="con" 
> path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
>
>
> I didn't used to get these entries in previous builds - and they screw my 
> Eclipse system, which is universally using JDK 6.x.
>
> Any idea why these entries are turning up - and more importantly, how to 
> get rid of them?
>
>
> Yours,  Mike. 


Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Mike Edwards <mi...@gmail.com>.
Raymond Feng wrote:
> 
> Can you try the following?
> 
> mvn eclipse:clean
> mvn -Peclipse -U
> 
> Thanks,
> Raymond

Sure.

Here is a sample:


C:\Tuscany_2_B\java\sca\modules\implementation-spring-xml>mvn -Peclipse -U
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Tuscany SCA Implementation Spring XML Model
[INFO]    task-segment: [org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing bundle:eclipse
[INFO] No goals needed for project - skipping
[INFO] [bundle:eclipse]
[INFO] Using Eclipse Workspace: C:\Tuscany_2_B\java\sca
[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program 
Files\Java\jre1.6.0_07
[INFO] Adding default classpath container: 
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5
[INFO] snapshot org.apache.tuscany.sca:tuscany-assembly-xml:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-assembly:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-policy:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-extensibility:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-interface:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-definitions:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-monitor:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-contribution:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-contribution-xml:2.0-SNAPSHOT: checking for updates 
from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-contribution-namespace:2.0-SNAPSHOT: checking for 
updates from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-core-spi:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-sca-api:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-contribution-java:2.0-SNAPSHOT: checking for updates 
from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-implementation-java:2.0-SNAPSHOT: checking for 
updates from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-interface-java:2.0-SNAPSHOT: checking for updates 
from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-implementation-spring:2.0-SNAPSHOT: checking for 
updates from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-implementation-java-runtime:2.0-SNAPSHOT: checking 
for updates from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-implementation-java-xml:2.0-SNAPSHOT: checking for 
updates from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-interface-java-xml:2.0-SNAPSHOT: checking for updates 
from apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-databinding:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-xsd:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] snapshot org.apache.tuscany.sca:tuscany-core:2.0-SNAPSHOT: checking for updates from 
apache.snapshots
[INFO] File C:\Tuscany_2_B\java\sca\modules\implementation-spring-xml\.project already exists.
        Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be 
removed.
[INFO] Wrote Eclipse project for "tuscany-implementation-spring-xml" to 
C:\Tuscany_2_B\java\sca\modules\implementation-spring-xml.
[INFO]
        Sources for some artifacts are not available.
        Please run the same goal with the -DdownloadSources=true parameter in order to check remote 
repositories for sources.
        List of artifacts without a source archive:
          o junit:junit:4.5
          o org.codehaus.woodstox:wstx-asl:3.2.4

        Javadoc for some artifacts is not available.
        Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote 
repositories for javadoc.
        List of artifacts without a javadoc archive:
          o junit:junit:4.5
          o org.codehaus.woodstox:wstx-asl:3.2.4

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Thu Apr 23 08:26:02 BST 2009
[INFO] Final Memory: 10M/254M
[INFO] ------------------------------------------------------------------------

C:\Tuscany_2_B\java\sca\modules\implementation-spring-xml>

-------------------------------------------------------------

So, the plugin is making a decision based on this, it appears:

[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program 
Files\Java\jre1.6.0_07

How it comes to this conclusion would be interesting to know.  My JRE runs Eclipse and runs all my 
Tuscany applications quite happily. But the "solution" of dumping in some random VM instead is worse 
than the problem!! This piece of code in the plugin should be revisited.

I suspect that there is some new/changed code in this area since this problem first appeared for me 
yesterday.  Whatever the code is, it would be best to remove it until this issue has been corrected.


Yours,  Mike.

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Raymond Feng <en...@gmail.com>.
Hi,

I just tried and I got the correct .classpath files:

<classpath>
  <classpathentry kind="src" path="src/test/java" 
output="target/test-classes" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/resources" 
excluding="**/*.java"/>
  <classpathentry kind="src" path="." including="LICENSE|NOTICE|MANIFEST.MF" 
excluding="**/*.java"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/4.5/junit-4.5.jar" 
sourcepath="M2_REPO/junit/junit/4.5/junit-4.5-sources.jar"/>
  <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
</classpath>

Can you try the following?

mvn eclipse:clean
mvn -Peclipse -U

Thanks,
Raymond
--------------------------------------------------
From: "Mike Edwards" <mi...@gmail.com>
Sent: Wednesday, April 22, 2009 8:57 AM
To: <de...@tuscany.apache.org>
Subject: Unexpected entries in .classpath files when running mvn -Peclipse - 
HELP PLEASE

> Folks,
>
> I ran a full build against Tuscany 2.0 after doing svn update earlier 
> today - and then executed  mvn -Peclipse against the result.
>
> The generated  .classpath files for the Eclipse projects all contained 
> this entry:
>
> <classpathentry kind="con" 
> path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
>
>
> I didn't used to get these entries in previous builds - and they screw my 
> Eclipse system, which is universally using JDK 6.x.
>
> Any idea why these entries are turning up - and more importantly, how to 
> get rid of them?
>
>
> Yours,  Mike. 


Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Simon Laws <si...@googlemail.com>.
> The irony is that I think many other folks using this avoid this code as
> their Eclipse workspace settings are such that the plugin code never finds
> their Eclipse workspace configuration data in which case the JRE
> configuration is left as:
>

and the mechanism here seems to be that if you have you Eclipse
workspace separate from the Tuscany code where the poms are then it
works (for me anyhow), e.g.

simon/
   tuscany_java_sca_chackout/
      modules/
        assembly/
            pom.xml
        etc.
   simons_workspaces
       my_java_workspace

Alternatively if you were to use tuscany_java_sca_chackout as your
workspace directly that would seem to be problematic as the maven
plugin looks backwards up the directory hierarchy from where the pom
it's processing is in order to find the workspace. If you workspace is
not in the same hierarchy it doesn't find any meta-data and just sets
the java version to the default.

Simon

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Mike Edwards <mi...@gmail.com>.
I'm sorry to say that the situation is worse than I first found.

My opinion is that the code inside org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.java
is a piece of garbage.

The main offending method is readAvailableJREs.

If you only have one JDK/JRE configured for your Eclipse workspace (as I do), even if that JRE is 
configured for both J2SE-1.5 and for J2SE-1.6 within Eclipse, then the code only picks up on one of 
them (1.6 in my case) but leaves the 1.5 configuration defaulted to:

org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5

...which screws up my configuration when it is written into the .classpath files...

The irony is that I think many other folks using this avoid this code as their Eclipse workspace 
settings are such that the plugin code never finds their Eclipse workspace configuration data in 
which case the JRE configuration is left as:

org.eclipse.jdt.launching.JRE_CONTAINER

...which leads to no problems!!


Yours,  Mike.

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Mike Edwards <mi...@gmail.com>.
Mike Edwards wrote:
> Folks,
> 
> I ran a full build against Tuscany 2.0 after doing svn update earlier 
> today - and then executed  mvn -Peclipse against the result.
> 
> The generated  .classpath files for the Eclipse projects all contained 
> this entry:
> 
> <classpathentry kind="con" 
> path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 
> 
> 
> 
> I didn't used to get these entries in previous builds - and they screw 
> my Eclipse system, which is universally using JDK 6.x.
> 
> Any idea why these entries are turning up - and more importantly, how to 
> get rid of them?
> 
> 
> Yours,  Mike.
> 
Folks,

This is probably a bug in the maven-eclipse-plugin code in version 2.6.

When it scans the Eclipse workspace settings, it goes looking for the JRE that Eclipse is using, in 
the class org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations

In here there is a method readAvailableJREs, which looks at the JRE entries in the Eclipse workspace 
configuration file org.eclipse.jdt.launching.prefs, which is in workspace directory 
..\.metadata\.plugins\org.eclipse.core.runtime\.settings

My config file has this as the path of the JRE that I am running:

path\="C\:\\Program Files\\Java\\jre1.6.0_07"

Note that this *IS* a JRE, not a JDK.

The code in readAvailableJREs reads the settings file and extracts the path setting (as above) and 
then attempts to confirm that the path is correct by doing this:

File rtJarFile = new File( new File( jrePath ), "jre/lib/rt.jar" );

....where "jrePath" is the value of the path entry quoted above.

Well, if the path entry IS a JRE, as in my case, the jrePath already points at the JRE directory and 
the rt.jar is in /lib/rt.jar *NOT* in /jre/lib/rt.jar.  In other words, the code in 
readAvailableJREs is assuming that the preferences entry is to a *JDK* not to a JRE, where indeed 
there is a /jre subdirectory containing the JRE.

However, Eclipse does *NOT* require that you use a JDK and is happy for the path to point purely to 
a JRE, as in my case.

So this code is bogus and needs fixing.

Of course, I scratch my head as to why they do this test at all.  If you find the entry for the JRE 
in the Eclipse configuration, why don't you simply assume it is correct??  If it were wrong then 
Eclipse would have a much bigger problem to deal with.


Yours, Mike.

Re: Unexpected entries in .classpath files when running mvn -Peclipse - HELP PLEASE

Posted by Raymond Feng <en...@gmail.com>.
I added the Bundle-RequiredExecutionEnvironment header to the OSGi MANIFE.MF 
so that the bundles can be correctly resolved in the Eclipse PDE with JDK 
1.5. Let me check if that causes the issue.

Thanks,
Raymond
--------------------------------------------------
From: "Mike Edwards" <mi...@gmail.com>
Sent: Wednesday, April 22, 2009 8:57 AM
To: <de...@tuscany.apache.org>
Subject: Unexpected entries in .classpath files when running mvn -Peclipse - 
HELP PLEASE

> Folks,
>
> I ran a full build against Tuscany 2.0 after doing svn update earlier 
> today - and then executed  mvn -Peclipse against the result.
>
> The generated  .classpath files for the Eclipse projects all contained 
> this entry:
>
> <classpathentry kind="con" 
> path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
>
>
> I didn't used to get these entries in previous builds - and they screw my 
> Eclipse system, which is universally using JDK 6.x.
>
> Any idea why these entries are turning up - and more importantly, how to 
> get rid of them?
>
>
> Yours,  Mike.