框架搭建成功,运行mvn install命令,尝试打包,又出错了。
Results :
Tests in error:
testContextInitialized(com.iteye.webapp.listener.StartupListenerTest)
testUserSearch(com.iteye.dao.UserDaoTest)
testSearch(com.iteye.webapp.action.UserActionTest)
Tests run: 67, Failures: 0, Errors: 3, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
在项目目录......rock\target\surefire-reports中找到com.iteye.webapp.listener.StartupListenerTest,察看详细内容
Test set: com.iteye.webapp.listener.StartupListenerTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.068 sec <<< FAILURE!
testContextInitialized(com.iteye.webapp.listener.StartupListenerTest) Time elapsed: 6.037 sec <<< ERROR!
org.compass.core.engine.SearchEngineException: Failed to rename index [target/test-index/index/user] to [target\test-index\index\user-copy0]
at org.compass.core.lucene.engine.store.FSDirectoryStore.beforeCopyFrom(FSDirectoryStore.java:157)
at org.compass.core.lucene.engine.store.DefaultLuceneSearchEngineStore.copyFrom(DefaultLuceneSearchEngineStore.java:616)
at org.compass.core.lucene.engine.store.DefaultLuceneSearchEngineStore.copyFrom(DefaultLuceneSearchEngineStore.java:602)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback$1$1.run(DefaultLuceneSearchEngineIndexManager.java:298)
at org.compass.core.lucene.engine.manager.IndexHoldersCache.doUnderCacheLock(IndexHoldersCache.java:126)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback$1.doInTransaction(DefaultLuceneSearchEngineIndexManager.java:294)
at org.compass.core.impl.DefaultCompass$CompassTransactionContext.execute(DefaultCompass.java:423)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback.secondStep(DefaultLuceneSearchEngineIndexManager.java:290)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doOperate(DefaultLuceneSearchEngineIndexManager.java:248)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doReplaceIndex(DefaultLuceneSearchEngineIndexManager.java:266)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.replaceIndex(DefaultLuceneSearchEngineIndexManager.java:261)
at org.compass.gps.impl.SingleCompassGps.doIndex(SingleCompassGps.java:118)
at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:154)
at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:128)
at com.iteye.webapp.listener.StartupListener.setupContext(StartupListener.java:110)
at com.iteye.webapp.listener.StartupListener.contextInitialized(StartupListener.java:93)
at com.iteye.webapp.listener.StartupListenerTest.testContextInitialized(StartupListenerTest.java:50)
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:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
参考http://up2pu.iteye.com/blog/1254093
修改rock\src\main\webapp\WEB-INF\applicationContext.xml 中内容
运行mvn install,错误减少到1个了
Results :
Tests in error:
testContextInitialized(com.iteye.webapp.listener.StartupListenerTest)
Tests run: 67, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
参照上面修改rock\src\main\resources\applicationContext-dao.xml中内容
运行mvn install
这个错误解决了,新错误出现了,仍然是参照http://up2pu.iteye.com/blog/1254093
终于成功,可以编写自己的代码了。