修改项目配置文件
由于导入的是普通项目,需要转化成Maven Project。Eclipse中项目的主要配置文件是.classpath和.project,还有.settings文件夹。
原项目为General project, 只有.project文件,其.project配置文件内容如下
<? xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name> druid</name>
<comment></comment>
<projects></projects>
<buildSpec></buildSpec>
<natures></natures>
</projectDescription>
需要修改.project,并添加.classpath文件:
<? xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name> druid</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.jdt.core.javanature</nature>
<nature> org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
还有.classpath文件
<? xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind ="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name ="optional" value="true"/>
<attribute name ="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding ="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name ="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind ="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name ="optional" value="true"/>
<attribute name ="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding ="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name ="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind ="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name ="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<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>
刷新项目
在项目上右键 > Refresh.
如果还有错误,可以在项目上右键 > Maven > Update project.. > OK, Eclipse 会自动重新建立.settings文件夹。
此时项目完成,可以直接提交到GitHub了。
