在使用Maven對Spring應用程序進行單元測試後完成構建時出現問題。我注意到mvn安裝沒有完成,並且在運行所有單元測試後它似乎掛起。從CMD行,如果我跑mvn install
我得到的測試來完成,但構建掛起Maven在運行Spring JUnit測試後掛起
Results :
Tests run: 34, Failures: 0, Errors: 0, Skipped: 0
14:20:15,588 [Thread-3] INFO GenericApplicationContext - Closing [email protected]a3b24: startup date [Wed Apr 25 14:20:08 EDT 2012]; root of context hierarchy
14:20:15,589 [Thread-3] INFO DefaultListableBeanFactory - Destroying singletons in org.s[email protected]16c163f: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,sysModel,alarmList,resourcePool,sysParams,stationHelper,commandTracker,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
14:20:15,595 [Thread-7] INFO GenericApplicationContext - Closing [email protected]577c: startup date [Wed Apr 25 14:20:10 EDT 2012]; root of context hierarchy
14:20:15,596 [Thread-7] INFO DefaultListableBeanFactory - Destroying singletons in org.s[email protected]10952e8: defining beans [alarmDao,purgeDao,xactionDao,dataSource,sysModel,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
這就是它的結束。兩個線程運行,不知道我在那裏做了什麼。無論如何,爲了排除故障,我刪除了所有測試,並讓程序完全構建。如果我運行mvn install -DskipTests
,我會完成它。最後,我添加了一個基本上是system.out.println(「hello world」)的JUnit測試。我可以通過註釋掉JUnit註釋「@RunWith(SpringJUnit4ClassRunner.class)」來讓安裝運行測試並完成安裝。我使用的是Spring 3.1.0.RELEASE。
構建的這個問題來自Windows7上的我的開發機器,但是基於Linux(Ubuntu 11.10)。 Hudson CI服務器使用相同的SVN存儲庫成功地在同一個項目上運行Maven安裝,每小時構建一次。
是的,檢查你是否正在做任何手動線程創建,或者如果你使用@Asynchronous或者Spring的定時器/執行程序代碼。 – sdouglass 2012-04-25 19:12:57