把jpress的github项目引入eclipse
- 技术交流
- 2427次浏览
在http://www.jpress.io/article/68 文章里,导入到idea或者eclipse的内容为 略。
今天试着导入到eclipse还挺麻烦的。
0. git clone https://github.com/JpressProjects/jpress.git
1. 在File菜单里选择import ,然后选择import一个maven--existing maven project
2. 选择root目录,就是下载的目录,然后选择主目录下的pom.xml就可以
3. 导入后发现项目没有java builder,所以在.project里加入:
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
和
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
4. 这时又了java builder后,要设置编译的目录和编译输出路径:
5. 发现项目的Deployment Assembly出错,显示The given project is not a virtual component project,这时候要在Project Facets选择正确的java 版本等:
6. 这时候发现没有 maven dependencies,要在.classpath加入如下一段:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
1个回答
7. 最后,去掉pom.xml里的<dependencyManagement>这个标签对。这个dependencyManagement只是声明依赖,但并不会自动引入jar包,所以在编译前先把这个去掉。这样Maven Dependencies就自动引入了。
开轩纳明月
回复