2009-08-31
■[Java][maven2] Sun が所有する APIに悩まされた 
eclipseでは何の問題もなくコンパイルされているソースが、mavenでビルドするとBUILD FAILUREとなる現象にちょっとはまりました。
こんな警告が出ます。
「○○ は Sun が所有する API であり、今後のリリースで削除される可能性があります。」
jdk5を使っているときは特になんの問題もなくビルドできていたのですが、jdk6にしてみようとしたら。。でした。
で、結果としてはrt.jarを明示的にコンパイル時のbootclasspathに設定してやったらビルドができるようになりました。
Now your code is relying on a Sun internal class and not a base JDK class. The appropriate classes exist in the $JAVA_HOME/lib/rt.jar file. Unfortunately, this jar file is NOT used by default when running javac. So to get my code to compile, I had to use the rt.jar in my bootclasspath. Since I am using Maven 2.0 as my build system, I had to add the following to the pom.xml where I am defining my compiler
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<verbose />
<bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
Compilation Struggles with Java 6 ScriptEngine, JavaScript, and Maven | Innovation On The Run
結構、情報を探したのでメモ。
# mavenってはまると情報が少なくていつも大変。。
- 3 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4SUNA_jaJP291JP291&q=Sun+が所有する+API+であり
- 2 http://www.google.co.jp/reader/view/
- 2 http://www.google.co.jp/search?hl=ja&q=Sun+が所有する+API+であり、今後のリリースで削除される可
- 1 http://d.hatena.ne.jp/iyuichi
- 1 http://d.hatena.ne.jp/keyword/Java
- 1 http://www.google.co.jp/search?hl=ja&client=firefox-a&rls=org.mozilla:ja:official&hs=OGR&q=Handler_read_rnd_next+設定&btnG=検索&lr=lang_ja
- 1 http://www.google.co.jp/search?hl=ja&lr=lang_ja&q=class+3+public+primary+certification+authority+G2&start=10&sa=N
- 1 http://www.google.co.jp/search?hl=ja&num=100&q=tcpdump 見る&btnG=検索&lr=
- 1 http://www.google.co.jp/search?hl=ja&q=AllowOverride&btnG=検索&lr=lang_ja
- 1 http://www.google.co.jp/search?hl=ja&q=apache+allowoverride&lr=lang_ja