Eclipse に インポートした際に作成される .project や .classpath の中身を確認しておこう。
.project :
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hoge</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>
buildCommand に org.eclipse.m2e.core.maven2Builder が追加されている。
また、natures に org.eclipse.m2e.core.maven2Nature が追加されて Maven プロジェクトになっている。
.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 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 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>
JRE_CONTAINER に J2SE-1.5 が指定されている。このために プロジェクトのJRE がJ2SE 1.5 環境を使うようになってしまっている。
MAVEN2_CLASSPATH_CONTAINER は Maven Depencency に相当するところ。
次は設定ファイルも見ておく。
.settings/org.eclipse.core.resources.prefs :
eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/test/java=UTF-8 encoding/<project>=UTF-8
.settings/org.eclipse.jdt.core.prefs :
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.5
.settings/org.eclipse.m2e.core.prefs :
activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1
org.eclipse.jdt.core.prefs の設定で、Java Compiler の 「Compiler compliance lecev」、「Generated .class files compatibility」、「Source compatibility」がいずれも「1.5」になっている。
"org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning" は、
Java Compiler > Erros/Warnings の「Non-static access to static member」が Warning になっていることに相当する。
前回の記事の import 後の後処理を実行した後は以下のようになる。
(src/test は削除していない)
.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 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 kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<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>
.project ファイルは変化はなく、.classpath が更新されている。
JRE_CONTAINER の後ろの実行環境指定がなくなってすっきりした。
設定ファイル。
Java Compiler 以下の設定がすべて workspace の設定を使用するようになり、 プロジェクト独自の設定がなくなったので、 org.eclipse.jdt.core.prefs ファイルがなくなっている。
org.eclipse.core.resources.prefs と org.eclipse.m2e.core.prefs ファイルは変化なし。

0 件のコメント:
コメントを投稿