Maven不会将类路径添加到Eclipse项目中 [英] Maven does not add classpath to Eclipse project

查看:92
本文介绍了Maven不会将类路径添加到Eclipse项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个maven项目,我正在使用Eclipse。



我使用maven eclipse:eclipse生成类路径,但是...它不会在eclipse项目中添加类路径。我已经尝试过maven-eclipse-plugin,我已经尝试过M2Eclipse插件了,但是我做的并不重要,我不能让classpath条目开始工作。我有许多构建错误,甚至认为maven完美地构建了耳朵。



任何指南?



感谢任何答案!



更新:这是我的根类路径:

 <?xml version =1.0encoding =UTF-8?> 
< classpath>
< classpathentry kind =srcpath =core / src / main / java/>
< classpathentry exclud =**kind =srcoutput =target / classespath =core / src / main / resources/>
< classpathentry kind =srcpath =client / src / main / java/>
< classpathentry kind =srcpath =client / src / main / resources/>
< classpathentry kind =srcpath =junit_server / src / main / java/>
< classpathentry kind =srcpath =initializer / src / main / java/>
< classpathentry kind =srcpath =initializer / src / main / webapp/>
< classpathentry kind =srcpath =site / src / main / webapp/>
< classpathentry kind =srcpath =core / src / test / java/>
< classpathentry kind =srcpath =core / src / test / resources/>
< classpathentry exported =truekind =conpath =org.eclipse.jdt.launching.JRE_CONTAINER/>
< classpathentry exported =truekind =varpath =M2_REPO/>
< classpathentry kind =outputpath =target / classes/>
< / classpath>

更新2:这是我的.project:



< pre class =lang-xml prettyprint-override> <?xml version =1.0encoding =UTF-8?>
< projectDescription>
< name> coreisp_back< / name>
< comment>< / comment>
< projects>
< / projects>
< buildSpec>
< buildCommand>
< name> org.eclipse.jdt.core.javabuilder< / name>
< arguments>
< / arguments>
< / buildCommand>
< buildCommand>
< name> org.eclipse.m2e.core.maven2Builder< / name>
< arguments>
< / arguments>
< / buildCommand>
< / buildSpec>
< natures>
< nature> org.eclipse.m2e.core.maven2Nature< / nature>
< nature> org.eclipse.jdt.core.javanature< / nature>
< / natures>
< / projectDescription>


解决方案

Maven Eclipse插件生成的设置不兼容m2e / m2eclipse。如果您想一起使用Maven和Eclipse,最好的方法是删除maven eclipse插件生成的安装修改,并使用m2e导入您的Maven项目。


I have a maven project, that I'm working on Eclipse.

I use maven eclipse:eclipse to generate the classpath, but ... it NEVER adds the classpath on the eclipse project. I've tried the maven-eclipse-plugin, I've tried the M2Eclipse plugin, but it doesn't matter what I do, I can't get the classpath entries to start working. I have many build errors, even thought the maven builds the ear perfectly.

Any guidelines?

Thanks for any answer!

UPDATE: Here's my root classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="core/src/main/java"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="core/src/main/resources"/>
    <classpathentry kind="src" path="client/src/main/java"/>
    <classpathentry kind="src" path="client/src/main/resources"/>
    <classpathentry kind="src" path="junit_server/src/main/java"/>
    <classpathentry kind="src" path="initializer/src/main/java"/>
    <classpathentry kind="src" path="initializer/src/main/webapp"/>
    <classpathentry kind="src" path="site/src/main/webapp"/>
    <classpathentry kind="src" path="core/src/test/java"/>
    <classpathentry kind="src" path="core/src/test/resources"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry exported="true" kind="var" path="M2_REPO"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

UPDATE2: This is my .project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>coreisp_back</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

解决方案

The setup generated by the Maven Eclipse plugin is not compatible with m2e/m2eclipse. If you want to use Maven and Eclipse together your best course is to remove any modification to your setup generated by the maven eclipse plugin and use m2e to import your Maven project.

这篇关于Maven不会将类路径添加到Eclipse项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆