2007年12月2日日曜日

mavenのtestフェーズがClassNotFoundException!

mvn testフェーズでsurefire-pluginが、以下のような出力で必ず失敗するようになった。
[INFO] Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException: MyTestClass; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException: MyTestClass [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException:MyTestClass; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException: MyTestClass   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)   at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   at java.lang.reflect.Method.invoke(Method.java:585)   at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)   at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)   at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)   at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException: MyTestClass; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to create test class 'MyTestClass'; nested exception is java.lang.ClassNotFoundException: MyTestClass... ...
target/test-classes配下にもちゃんと生成されてるし、なんだなんだ?とずいぶん長い時間はまったが、原因は「絶対パスでprojectフォルダを表現したときに、その一部に日本語が含まれている事」だった模様。海外のサイトでうまくたどりつけて、「途中に空白文字があると…」といぅのをみて何とか気づいた。有名な問題なんですかねぇ。

Blogged with Flock

コメントを投稿