让Maven项目工作

时间:2014-07-15 19:26:30

标签: java eclipse maven svn

我是Maven的新手 我获得了最新的Eclipse版本(Luna for Java Developers)并安装了Subversive SVN 然后我检查了一个Maven项目。由于没有被认可,我将其转换为“Maven项目”。之后我做了一个mvn eclipse:clean eclipse:eclipse并刷新了项目(出现了一个pom.xml) 当我尝试创建运行配置时,它找不到主类,尽管它确实存在。在主标签中,我可以浏览我的项目,但是我可以选择主类的窗口仍然是空的 我知道这个项目中有一个主类,但我无法选择它。

PS:尽管有Eclipses m2e插件,我还在我的机器上安装了一个本地Maven存储库。我不知道是否有必要。它甚至在Windows->Preferences->Java->Build Path->Classpath Variables中将其识别为M2_REPO (non modifiable) - C:\Users\MyName\.m2\repository。可能来自我的旧Eclipse实例,它没有m2e插件。

编辑1:.classpath

<?xml version="1.0" encoding="UTF-8"?>
<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="output" path="target/classes"/>
  <classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4.1/mail-1.4.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1.9.v200905050702_orbit/jaxb-api-2.1.9.v200905050702_orbit.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-core/4.5.0/lucene-core-4.5.0.jar" sourcepath="M2_REPO/org/apache/lucene/lucene-core/4.5.0/lucene-core-4.5.0-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-analyzers-common/4.5.0/lucene-analyzers-common-4.5.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-queryparser/4.5.0/lucene-queryparser-4.5.0.jar" sourcepath="M2_REPO/org/apache/lucene/lucene-queryparser/4.5.0/lucene-queryparser-4.5.0-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-queries/4.5.0/lucene-queries-4.5.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-sandbox/4.5.0/lucene-sandbox-4.5.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/jakarta-regexp/jakarta-regexp/1.4/jakarta-regexp-1.4.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.3.1/httpclient-4.3.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.3/httpcore-4.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.6/commons-codec-1.6.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/tmatesoft/svnkit/svnkit/1.7.8/svnkit-1.7.8.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/tmatesoft/sqljet/sqljet/1.1.6/sqljet-1.1.6.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.4/antlr-runtime-3.4.jar"/>
  <classpathentry kind="var" path="M2_REPO/de/regnis/q/sequence/sequence-library/1.0.2/sequence-library-1.0.2.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/trilead/trilead-ssh2/1.0.0-build215/trilead-ssh2-1.0.0-build215.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1.3/xmlrpc-client-3.1.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.3/xmlrpc-common-3.1.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar"/>
  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/semanticdesktop/aperture/aperture-core/1.6.0/aperture-core-1.6.0.jar" sourcepath="M2_REPO/org/semanticdesktop/aperture/aperture-core/1.6.0/aperture-core-1.6.0-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/semanticdesktop/nepomuk/aperture-tools-demork/1.0.0/aperture-tools-demork-1.0.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/info/aduna/commons/aduna-commons-xml/2.6.0/aduna-commons-xml-2.6.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/info/aduna/commons/aduna-commons-text/2.6.0/aduna-commons-text-2.6.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.2/jcl-over-slf4j-1.6.2.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/semweb4j/rdf2go.api/4.7.3/rdf2go.api-4.7.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-compress/1.3/commons-compress-1.3.jar"/>
  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1.0.v20080605-1935_orbit/commons-httpclient-3.1.0.v20080605-1935_orbit.jar"/>
  <classpathentry kind="var" path="M2_REPO/ronaldhttpclient/uncompressinputstream/0.3.3.aperture/uncompressinputstream-0.3.3.aperture.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi/3.8-beta5/poi-3.8-beta5.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-scratchpad/3.8-beta5/poi-scratchpad-3.8-beta5.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-ooxml/3.8-beta5/poi-ooxml-3.8-beta5.jar"/>
  <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-ooxml-schemas/3.8-beta5/poi-ooxml-schemas-3.8-beta5.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar"/>
  <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/textmining/tm-extractors/1.0-aperture.bundle/tm-extractors-1.0-aperture.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/pdfbox/1.7.0-1225586/pdfbox-1.7.0-1225586.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/jempbox/1.7.0-1225586/jempbox-1.7.0-1225586.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/fontbox/1.7.0-1225586/fontbox-1.7.0-1225586.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcmail-jdk14/1.44/bcmail-jdk14-1.44.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcprov-jdk14/1.44/bcprov-jdk14-1.44.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/htmlparser/htmlparser/1.6.bundle/htmlparser-1.6.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/sourceforge/juniversalchardet/juniversalchardet/1.0.3.bundle/juniversalchardet-1.0.3.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/mnode/ical4j/ical4j/1.0.3-java15-201109231401/ical4j-1.0.3-java15-201109231401.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/fortuna/ical4j/ical4j-vcard/0.9.3-SNAPSHOT-20110629/ical4j-vcard-0.9.3-SNAPSHOT-20110629.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/fortuna/mstor/mstor/0.9.13-SNAPSHOT-20110629/mstor-0.9.13-SNAPSHOT-20110629.jar"/>
  <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/jul-to-slf4j/1.6.1/jul-to-slf4j-1.6.1.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/drewnoakes/metadata-extractor/2.4.0-beta1.bundle/metadata-extractor-2.4.0-beta1.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/jaudiotagger/jaudiotagger/1.0.8.bundle/jaudiotagger-1.0.8.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/beetstra/jutf7/jutf7/0.9.0.bundle/jutf7-0.9.0.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/sf/jacob-project/jacob/1.14.3.bundle/jacob-1.14.3.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/aetrion/flickr/flickrapi/1.2.bundle/flickrapi-1.2.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bibsonomy/bibsonomy-rest-client/2.0.4-SNAPSHOT.bundle/bibsonomy-rest-client-2.0.4-SNAPSHOT.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bibsonomy/bibsonomy-rest-common/2.0.4-SNAPSHOT.bundle/bibsonomy-rest-common-2.0.4-SNAPSHOT.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bibsonomy/bibsonomy-model/2.0.4-SNAPSHOT.bundle/bibsonomy-model-2.0.4-SNAPSHOT.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/bibsonomy/bibsonomy-common/2.0.4-SNAPSHOT.bundle/bibsonomy-common-2.0.4-SNAPSHOT.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/it/unimi/dsi/fastutil/chars/charopenhashset/5.0.9.bundle/charopenhashset-5.0.9.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/jtidy/jtidy/8.0-SNAPSHOT.bundle/jtidy-8.0-SNAPSHOT.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.9.bundle/jaxb-impl-2.1.9.bundle.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/samba/jcifs/jcifs/1.3.14/jcifs-1.3.14.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/tika/tika-core/1.1-r1221686/tika-core-1.1-r1221686.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/apache/tika/tika-parsers/1.1-r1221686/tika-parsers-1.1-r1221686.jar"/>
  <classpathentry kind="var" path="M2_REPO/xom/xom/1.2.6/xom-1.2.6.jar"/>
  <classpathentry kind="var" path="M2_REPO/gov/lbl/acs/nux/nux/1.6-onelementxpath/nux-1.6-onelementxpath.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8-xqj.jar"/>
  <classpathentry kind="var" path="M2_REPO/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8-dom.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/openrdf/sesame/sesame-runtime-osgi/2.5.2-r11285-osgipatch/sesame-runtime-osgi-2.5.2-r11285-osgipatch.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/semanticdesktop/aperture/aperture-core/1.6.0/aperture-core-1.6.0-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/semweb4j/rdf2go.impl.sesame23/4.7.5-SNAPSHOT-RTGO-77/rdf2go.impl.sesame23-4.7.5-SNAPSHOT-RTGO-77.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar"/>
  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
</classpath>

3 个答案:

答案 0 :(得分:0)

m2eclipse和maven-eclipse-plugin 彼此兼容。 maven-eclipse-plugin是一个老插件,可以为你准备eclipse,但是现在m2eclipse是首选方式,因为它集成得更好。

答案 1 :(得分:0)

尝试将.classpath文件更新为

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" excluding="**/.svn/" path="src/main/java" output="target/classes"/>
    <classpathentry kind="src" excluding="**/.svn/" output="target/test-classes" path="src/test/java"/>
    <classpathentry kind="src" excluding="**/.svn/" path="src/main/resources"/>
    <classpathentry kind="src" excluding="**/.svn/" path="src/test/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
            <attributes>
                <attribute name="maven.pomderived" value="true"/>
            </attributes>
    </classpathentry>

    <classpathentry kind="output" path="target/classes"/>
</classpath>

答案 2 :(得分:-1)

安装IntelliJ IDEA CE。你将不再遇到Maven,ANT,Gradle,Git等工具的问题......还有很多...... :)