You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Patrick Mueller <pm...@yahoo.com> on 2004/02/12 22:35:09 UTC

eclipse .classpath fixer-upper for incubator-geronimo

I've got a little .classpath (and .project) fixer-upper for the 
incubator-geronimo project if you happen to want to suck it into eclipse.

Attached as maven-fixup.py (yes, written in Python; baby steps .. baby 
steps ... the good news is the processing is fairly simple to gen this, 
so it can probably be done in maven/jelly, I just don't know how yet).

I've also attached the generated .classpath file and .project file.

Not perfect, but I'm not sure if it can be in eclipse anyway.  You'll 
still red X's in eclipse for:

- sandbox/twiddle/src/java

- sandbox/webdav/src/java

- some of the xmlbeans stuff; this is because the gen'd classes are 
duplicated across multiple source folders; eclipse doesn't like this; I 
think source folders in eclipse can be filtered, so a smarter version of 
the tool could filter the dups away; but this might not work outside of 
eclipse, if those classes are actually required by the runtime.

I HAVE NOT VERIFIED THAT THE SERVER CAN RUN AFTER COMPILING THE CLASSES 
THIS WAY.

That's not my intent (yet); I just wanted to use sexy eclipse browsing 
to peruse the geronimo universe, without seeing compiler errors all over 
the place.

Other eclipse notes:

- make sure you turn on 1.4 level compiler compliance; assert is used 
throughout geronimo, and the default compiler settings essentially mark 
these as compiler errors

- you'll want to turn off warnings for unused imports, and some other 
things like static members accessed in a non-static fashion sort of 
thing.  Cuts way back on the number of warnings.

- you'll want to filter referenced libraries off in the Java 
perspective's navigator; there are 32 source folders, and 41 referenced 
libraries - the list of 'things' is just annoyingly long and you can 
live without the referenced libraries.

-- 
Patrick Mueller
pmuellr@yahoo.com


Re: eclipse .classpath fixer-upper for incubator-geronimo

Posted by Patrick Mueller <pm...@yahoo.com>.
Patrick Mueller wrote:
> ...
> I HAVE NOT VERIFIED THAT THE SERVER CAN RUN AFTER COMPILING THE CLASSES 
> THIS WAY.
> ...

Just to report that I was able to get the jmx-console to come up with an 
  Eclipse launch.  Just transliterated the run:server goal in the 
assembly/maven.xml into an Eclipse launch.  Works both in Run and Debug.

I've attached a .launch file for it (note: Eclipse 3.0M6, if it matters)

-- 
Patrick Mueller
pmuellr@yahoo.com

Re: eclipse .classpath fixer-upper for incubator-geronimo

Posted by David Jencks <da...@coredevelopers.net>.
On Thursday, February 12, 2004, at 01:35 PM, Patrick Mueller wrote:

> I've got a little .classpath (and .project) fixer-upper for the  
> incubator-geronimo project if you happen to want to suck it into  
> eclipse.
>
> Attached as maven-fixup.py (yes, written in Python; baby steps .. baby  
> steps ... the good news is the processing is fairly simple to gen  
> this, so it can probably be done in maven/jelly, I just don't know how  
> yet).
>
> I've also attached the generated .classpath file and .project file.
>
> Not perfect, but I'm not sure if it can be in eclipse anyway.  You'll  
> still red X's in eclipse for:
>
> - sandbox/twiddle/src/java
>
> - sandbox/webdav/src/java
>
> - some of the xmlbeans stuff; this is because the gen'd classes are  
> duplicated across multiple source folders; eclipse doesn't like this;  
> I think source folders in eclipse can be filtered, so a smarter  
> version of the tool could filter the dups away; but this might not  
> work outside of eclipse, if those classes are actually required by the  
> runtime.

they aren't, and this is a problem in idea also.  I need  to figure out  
how to manipulate the xmlbeans plugin's classpath so the duplicates  
don't get generated in the first place.

david jencks

>
> I HAVE NOT VERIFIED THAT THE SERVER CAN RUN AFTER COMPILING THE  
> CLASSES THIS WAY.
>
> That's not my intent (yet); I just wanted to use sexy eclipse browsing  
> to peruse the geronimo universe, without seeing compiler errors all  
> over the place.
>
> Other eclipse notes:
>
> - make sure you turn on 1.4 level compiler compliance; assert is used  
> throughout geronimo, and the default compiler settings essentially  
> mark these as compiler errors
>
> - you'll want to turn off warnings for unused imports, and some other  
> things like static members accessed in a non-static fashion sort of  
> thing.  Cuts way back on the number of warnings.
>
> - you'll want to filter referenced libraries off in the Java  
> perspective's navigator; there are 32 source folders, and 41  
> referenced libraries - the list of 'things' is just annoyingly long  
> and you can live without the referenced libraries.
>
> --  
> Patrick Mueller
> pmuellr@yahoo.com
>
> #!/usr/bin/python
>
> import os
> import sys
> import string
>
> import xml.dom
> import xml.dom.minidom
>
> mavenRepo = os.path.expanduser("~/.maven/repository")
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
> def getProjectDirs(root, path, result):
>
>     rootPath = "%s/%s" % (root,path)
>
>     entries = os.listdir(rootPath)
>
>     for entry in entries:
>         rootPathEntry = "%s/%s" % (rootPath,entry)
>         pathEntry     = "%s/%s" % (path,entry)
>
>         if (os.path.isdir(rootPathEntry)):
>             getProjectDirs(root,pathEntry,result)
>             continue
>
>         if (entry == "project.xml"):
>             srcJavaPath = "%s/src/java" % rootPath
>             if (os.path.exists(srcJavaPath)):
>                 result.append(os.path.normpath(path).replace("\\","/"))
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
> def getXmlBeansDirs(root, path, result):
>
>     rootPath = "%s/%s" % (root,path)
>
>     entries = os.listdir(rootPath)
>
>     for entry in entries:
>         rootPathEntry = "%s/%s" % (rootPath,entry)
>         pathEntry     = "%s/%s" % (path,entry)
>
>         if (os.path.exists("%s/%s/target/xmlbeans" %  
> (rootPath,entry))):
>             result.append(os.path.normpath("%s/%s" %  
> (path,entry)).replace("\\","/"))
>
>         if (os.path.isdir(rootPathEntry)):
>             getXmlBeansDirs(root,pathEntry,result)
>             continue
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
> def getXmlText(element,subElementName):
>
>     subElements = element.getElementsByTagName(subElementName)
>     if (len(subElements) == 0): return ""
>
>     result      = ""
>     subElement  = subElements[0]
>
>     for child in subElement.childNodes:
>         if (child.nodeType == xml.dom.Node.TEXT_NODE):
>             result = result + child.data
>
>     return result
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
> def getMavenDependencies(dom,projectDir,mavenDependencies):
>
>     #  
> ~/.maven/repository/commons-logging/jars/commons-logging-1.0.3.jar
>     # ${repo}/${groupId}/${type}s/${artifactId}-${version}.${type}
>
> #   print "Dependencies for %s" % projectDir
>
>     dependencyElements = dom.getElementsByTagName("dependency")
>     for dependencyElement in dependencyElements:
>         elementId         = getXmlText(dependencyElement,"id")
>         elementVersion    = getXmlText(dependencyElement,"version")
>         elementGroupId    = getXmlText(dependencyElement,"groupId")
>         elementArtifactId = getXmlText(dependencyElement,"artifactId")
>         elementType       = getXmlText(dependencyElement,"type")
>         elementUrl        = getXmlText(dependencyElement,"url")
>
>         if (elementType == ""): elementType = "jar"
>
> #       print "   dependency: "
> #       print "      id:         %s" % elementId
> #       print "      version:    %s" % elementVersion
> #       print "      groupId:    %s" % elementGroupId
> #       print "      artifactId: %s" % elementArtifactId
>
>         if (elementGroupId != ""):
>             testFile = "%s/%ss/%s-%s.%s" %  
> (elementGroupId,elementType,elementArtifactId,elementVersion,elementTyp 
> e)
>         elif (elementArtifactId != ""):
>             testFile = "%s/%ss/%s-%s.%s" %  
> (elementId,elementType,elementArtifactId,elementVersion,elementType)
>         elif (-1 != elementId.find("+")):
>             repoDir  = elementId.split("+")[0]
>             repoName = elementId.replace("+","-")
>             testFile = "%s/%ss/%s-%s.%s" %  
> (repoDir,elementType,repoName,elementVersion,elementType)
>         else:
>             testFile = "%s/%ss/%s-%s.%s" %  
> (elementId,elementType,elementId,elementVersion,elementType)
>
>         testAbsFile = "%s/%s" % (mavenRepo,testFile)
>
>         if (elementVersion == "DEV"):
> #           print "Skipping %s for %s since it's probably a  
> subproject" % (testFile,projectDir)
>             pass
>
>         elif (os.path.exists(testAbsFile)):
>             if (testFile not in mavenDependencies):
>                 mavenDependencies.append(testFile)
>
>         else:
>             print "Unable to find file in maven repo: %s for %s" %  
> (testFile,projectDir)
>             print "   dependency: for %s" % projectDir
>             print "      id:         %s" % elementId
>             print "      version:    %s" % elementVersion
>             print "      groupId:    %s" % elementGroupId
>             print "      artifactId: %s" % elementArtifactId
>             print "      url:        %s" % elementUrl
>             print
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
>
> thisFile = sys.argv[0]
>
> igPath = "%s/../incubator-geronimo" % os.path.dirname(thisFile)
>
> projectDirs       = []
> xmlBeansDirs      = []
> mavenDependencies = []
> projectDoms       = {}
>
> getProjectDirs(igPath,".",projectDirs)
> getXmlBeansDirs(igPath,".",xmlBeansDirs)
>
> #print "Found the following project dirs:"
> #for projectDir in projectDirs:
> #   print "   %s" % projectDir
> #print
>
> for projectDir in projectDirs:
>     dom = xml.dom.minidom.parse("%s/%s/project.xml" %  
> (igPath,projectDir))
>     projectDoms[projectDir] = dom
>
>     getMavenDependencies(dom,projectDir,mavenDependencies)
>
> classpathFileName = "%s/.classpath" % igPath
>
> print "Rewriting %s" % classpathFileName
>
> classpathFile = open(classpathFileName,"w")
>
> print >>classpathFile, '<?xml version="1.0" encoding="UTF-8"?>'
> print >>classpathFile, '<!-- generated by %s -->' %  
> os.path.basename(thisFile)
> print >>classpathFile, '<classpath>'
> print >>classpathFile, '    <classpathentry kind="con"  
> path="org.eclipse.jdt.launching.JRE_CONTAINER"/>'
>
> for projectDir in projectDirs:
>     print "Adding source folder for %s" % projectDir
>     print >>classpathFile, '    <classpathentry kind="src"  
> path="%s/src/java" out="%s/target/classes" />' %  
> (projectDir,projectDir)
>
> for xmlBeansDir in xmlBeansDirs:
>     print "Adding source folder for %s (xmlbeans)" % xmlBeansDir
>     print >>classpathFile, '    <classpathentry kind="src"  
> path="%s/target/xmlbeans" out="%s/target/classes" />' %  
> (xmlBeansDir,xmlBeansDir)
>
> for mavenDependency in mavenDependencies:
>     print "Adding jar reference for %s" % mavenDependency
>     print >>classpathFile, '    <classpathentry kind="var"  
> path="MAVEN_REPO/%s"/>' % mavenDependency
>
> print >>classpathFile, '</classpath>'
>
> classpathFile.close()
>
> #<?xml version="1.0" encoding="UTF-8"?>
> #<classpath>
> #   <classpathentry kind="src" path="specs/ejb/src/java"  
> out="specs/ejb/target" />
> #   <classpathentry kind="src" path="specs/jta/src/java"  
> out="specs/jta/target" />
> #   <classpathentry kind="src" path="specs/j2ee-connector/src/java"  
> out="specs/j2ee-connector/target" />
> #   <classpathentry kind="src" path="specs/j2ee-deployment/src/java"  
> out="specs/j2ee-deployment/target" />
> #   <classpathentry kind="con"  
> path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
> #</classpath>
>
> #--------------------------------------------------------------------
> #
> #--------------------------------------------------------------------
>
> projectFileName = "%s/.project" % igPath
>
> print "Rewriting %s" % projectFileName
>
> projectFile = open(projectFileName,"w")
>
> print >>projectFile, '<?xml version="1.0" encoding="UTF-8"?>'
> print >>projectFile, '<!-- generated by %s -->' %  
> os.path.basename(thisFile)
> print >>projectFile, '<projectDescription>'
> print >>projectFile, '  <name>incubator-geronimo</name>'
> print >>projectFile, '  <comment></comment>'
> print >>projectFile, '  <projects>'
> print >>projectFile, '  </projects>'
> print >>projectFile, '  <buildSpec>'
> print >>projectFile, '      <buildCommand>'
> print >>projectFile, '           
> <name>org.eclipse.jdt.core.javabuilder</name>'
> print >>projectFile, '          <arguments>'
> print >>projectFile, '          </arguments>'
> print >>projectFile, '      </buildCommand>'
> print >>projectFile, '  </buildSpec>'
> print >>projectFile, '  <natures>'
> print >>projectFile, '       
> <nature>org.eclipse.jdt.core.javanature</nature>'
> print >>projectFile, '  </natures>'
> print >>projectFile, '</projectDescription>'
>
> projectFile.close()
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- generated by maven-fixup.py -->
> <classpath>
>     <classpathentry kind="con"  
> path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
>     <classpathentry kind="src" path="modules/clustering/src/java"  
> out="modules/clustering/target/classes" />
>     <classpathentry kind="src" path="modules/common/src/java"  
> out="modules/common/target/classes" />
>     <classpathentry kind="src" path="modules/connector/src/java"  
> out="modules/connector/target/classes" />
>     <classpathentry kind="src" path="modules/console-web/src/java"  
> out="modules/console-web/target/classes" />
>     <classpathentry kind="src" path="modules/core/src/java"  
> out="modules/core/target/classes" />
>     <classpathentry kind="src" path="modules/deployment/src/java"  
> out="modules/deployment/target/classes" />
>     <classpathentry kind="src" path="modules/jetty/src/java"  
> out="modules/jetty/target/classes" />
>     <classpathentry kind="src" path="modules/kernel/src/java"  
> out="modules/kernel/target/classes" />
>     <classpathentry kind="src"  
> path="modules/maven-xmlbeans-plugin/src/java"  
> out="modules/maven-xmlbeans-plugin/target/classes" />
>     <classpathentry kind="src" path="modules/remoting/src/java"  
> out="modules/remoting/target/classes" />
>     <classpathentry kind="src" path="modules/security/src/java"  
> out="modules/security/target/classes" />
>     <classpathentry kind="src" path="modules/transaction/src/java"  
> out="modules/transaction/target/classes" />
>     <classpathentry kind="src" path="sandbox/activation/src/java"  
> out="sandbox/activation/target/classes" />
>     <classpathentry kind="src" path="sandbox/explorer/src/java"  
> out="sandbox/explorer/target/classes" />
>     <classpathentry kind="src" path="sandbox/javamail/src/java"  
> out="sandbox/javamail/target/classes" />
>     <classpathentry kind="src" path="sandbox/mail/src/java"  
> out="sandbox/mail/target/classes" />
>     <classpathentry kind="src" path="sandbox/twiddle/src/java"  
> out="sandbox/twiddle/target/classes" />
>     <classpathentry kind="src" path="sandbox/webdav/src/java"  
> out="sandbox/webdav/target/classes" />
>     <classpathentry kind="src" path="specs/ejb/src/java"  
> out="specs/ejb/target/classes" />
>     <classpathentry kind="src" path="specs/j2ee-connector/src/java"  
> out="specs/j2ee-connector/target/classes" />
>     <classpathentry kind="src" path="specs/j2ee-deployment/src/java"  
> out="specs/j2ee-deployment/target/classes" />
>     <classpathentry kind="src" path="specs/j2ee-jacc/src/java"  
> out="specs/j2ee-jacc/target/classes" />
>     <classpathentry kind="src" path="specs/j2ee-management/src/java"  
> out="specs/j2ee-management/target/classes" />
>     <classpathentry kind="src" path="specs/jms/src/java"  
> out="specs/jms/target/classes" />
>     <classpathentry kind="src" path="specs/jsp/src/java"  
> out="specs/jsp/target/classes" />
>     <classpathentry kind="src" path="specs/jta/src/java"  
> out="specs/jta/target/classes" />
>     <classpathentry kind="src" path="specs/servlet/src/java"  
> out="specs/servlet/target/classes" />
>     <classpathentry kind="src"  
> path="modules/connector/target/xmlbeans"  
> out="modules/connector/target/classes" />
>     <classpathentry kind="src"  
> path="modules/deployment/target/xmlbeans"  
> out="modules/deployment/target/classes" />
>     <classpathentry kind="src" path="modules/jetty/target/xmlbeans"  
> out="modules/jetty/target/classes" />
>     <classpathentry kind="src" path="modules/security/target/xmlbeans"  
> out="modules/security/target/classes" />
>     <classpathentry kind="src" path="specs/schema/target/xmlbeans"  
> out="specs/schema/target/classes" />
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/mx4j/jars/mx4j-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-lang/jars/commons-lang-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-collections/jars/commons-collections- 
> SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-jexl/jars/commons-jexl-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/mx4j/jars/mx4j-jmx-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/xmlbeans/jars/xbean-apache-1.0-DEV.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/cglib/jars/cglib-full-2.0-RC2.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/concurrent/jars/concurrent-1.3.2.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/regexp/jars/regexp-1.3-dev.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-jxpath/jars/commons-jxpath-1.1.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/xerces/jars/xercesImpl-2.6.0.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/xml-apis/jars/xml-apis-1.0.b2.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/dom4j/jars/dom4j-1.4.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/xml-commons-resolver/jars/xml-commons-resolver- 
> 1.1.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-cli/jars/commons-cli-1.0.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/jetty/jars/org.mortbay.jetty-5.0.beta0.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/jasper-compiler-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/jasper-runtime-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-el/jars/commons-el-1.0.jar"/>
>     <classpathentry kind="var" path="MAVEN_REPO/ant/jars/ant-1.5.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/xerces/jars/xmlParserAPIs-2.2.1.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/hsqldb/jars/hsqldb-1.7.1.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/groovy/jars/groovy-1.0-alpha-1.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/asm/jars/asm-1.3.4.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/asm/jars/asm-util-1.3.4.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/classworlds/jars/classworlds-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/castor/jars/castor-0.9.5.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/commons-beanutils/jars/commons-beanutils- 
> SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/jetty/jars/jetty-SNAPSHOT.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/catalina-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/catalina-optional-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/naming-common-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/naming-resources-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/servlets-common-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/servlets-default-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/servlets-webdav-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/tomcat/jars/tomcat-util-5.0.16.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/mockobjects/jars/mockobjects-jdk1.4-j2ee1.3- 
> 0.09.jar"/>
>     <classpathentry kind="var"  
> path="MAVEN_REPO/mockobjects/jars/mockobjects-core-0.09.jar"/>
> </classpath>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- generated by maven-fixup.py -->
> <projectDescription>
>   <name>incubator-geronimo</name>
>   <comment></comment>
>   <projects>
>   </projects>
>   <buildSpec>
>       <buildCommand>
>           <name>org.eclipse.jdt.core.javabuilder</name>
>           <arguments>
>           </arguments>
>       </buildCommand>
>   </buildSpec>
>   <natures>
>       <nature>org.eclipse.jdt.core.javanature</nature>
>   </natures>
> </projectDescription>