Intellij不会使用加载时编织进行单元测试?

时间:2015-07-06 20:55:39

标签: java spring maven unit-testing intellij-idea

我正在使用Intellij 14.1.4 Ultimate,并尝试运行单元测试。直接从Maven 3.3.1调用时,此测试运行正常。但是当我尝试从Intellij的JUnit配置运行它时,它完全没有说它无法初始化加载时织入器。我对此感到困惑,因为它应该运行完全相同的测试。如果您查看Intellij命令行,它将加载正确的Spring jar,但是在任何类似的Intellij正在使用的类加载器中,Spring jar都会出现问题。任何人都可以识别问题以及如何解决它?

Maven输出(Intellij输出进一步向下):

<tbody> 

<tr ng-repeat-start=“x in object.sibling”>

       <td class=“x”>

<tr ng-repeat-start=“y in x.child”>

       <td class=“Y”>

<tr ng-repeat-end=“”>

<tr ng-repeat-end=“”>

Intellij输出:

mvn -Dtest=AccountRequestBaseSIDTest test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject Online (Domain) DEV-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ MyProjectDomain ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (jacoco-initialize) @ MyProjectDomain ---
[INFO] argLine set to -javaagent:C:\Users\tomw\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\JavaSoftware\workspace_frag2\FC
O\MyProjectDomain\target\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyProjectDomain ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 61 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MyProjectDomain ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2ddl (hsql) > process-resources @ MyProjectDomain >>>
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ MyProjectDomain ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (jacoco-initialize) @ MyProjectDomain ---
[INFO] argLine set to -javaagent:C:\Users\tomw\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\JavaSoftware\workspace_frag2\FC
O\MyProjectDomain\target\jacoco.exec -javaagent:C:\Users\tomw\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\JavaSoftware\wor
kspace_frag2\FCO\MyProjectDomain\target\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyProjectDomain ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 61 resources
[INFO]
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2ddl (hsql) < process-resources @ MyProjectDomain <<<
[INFO]
[INFO] --- hibernate3-maven-plugin:2.2:hbm2ddl (hsql) @ MyProjectDomain ---
[INFO] Hibernate 3.3.1.GA
[INFO] hibernate.properties not found
[INFO] Bytecode provider name : javassist
[INFO] using JDK 1.4 java.sql.Timestamp handling
[INFO] No hibernate configuration file loaded.
[INFO] Configuration Properties file loaded: D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\src\main\resources\properties\hibernate-hsql.properties
[INFO] Using dialect: org.hibernate.dialect.HSQLDialect
[INFO] Running hbm2ddl schema export
[INFO] writing generated schema to file: D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\target\classes\database\MyProject.hsql
[INFO] schema export complete
[INFO]
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2ddl (mysql) > process-resources @ MyProjectDomain >>>
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ MyProjectDomain ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.6.3.201306030806:prepare-agent (jacoco-initialize) @ MyProjectDomain ---
[INFO] argLine set to -javaagent:C:\Users\tomw\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\JavaSoftware\workspace_frag2\FC
O\MyProjectDomain\target\jacoco.exec -javaagent:C:\Users\tomw\.m2\repository\org\jacoco\org.jacoco.agent\0.6.3.201306030806\org.jacoco.agent-0.6.3.201306030806-runtime.jar=destfile=D:\JavaSoftware\wor
kspace_frag2\FCO\MyProjectDomain\target\jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyProjectDomain ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 61 resources
[INFO]
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2ddl (mysql) < process-resources @ MyProjectDomain <<<
[INFO]
[INFO] --- hibernate3-maven-plugin:2.2:hbm2ddl (mysql) @ MyProjectDomain ---
[INFO] No hibernate configuration file loaded.
[INFO] Configuration Properties file loaded: D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\src\main\resources\properties\hibernate-mysql.properties
[INFO] Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
[INFO] Running hbm2ddl schema export
[INFO] writing generated schema to file: D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\target\classes\database\MyProject.sql
[INFO] schema export complete
[INFO]
[INFO] --- exec-maven-plugin:1.1.1:exec (roles) @ MyProjectDomain ---
[INFO]
[INFO] --- exec-maven-plugin:1.1.1:exec (groups) @ MyProjectDomain ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MyProjectDomain ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 56 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MyProjectDomain ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 203 source files to D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\target\test-classes
[WARNING] /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/src/test/java/test/services/EmailServiceMockTest.java:[106,42] mergeTemplateIntoString(org.apache.velocity.app.VelocityEngine,java.lang.S
tring,java.util.Map<java.lang.String,java.lang.Object>) in org.springframework.ui.velocity.VelocityEngineUtils has been deprecated
[WARNING] /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/src/test/java/test/model/GroupStoreTest.java:[106,52] equals(java.lang.Object,java.lang.Object) in org.apache.commons.lang3.ObjectUtils h
as been deprecated
[WARNING] /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/src/test/java/test/model/GroupStoreTest.java:[130,52] equals(java.lang.Object,java.lang.Object) in org.apache.commons.lang3.ObjectUtils h
as been deprecated
[WARNING] /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/src/test/java/test/webservices/EPCPartTypeServiceTest.java: Some input files use unchecked or unsafe operations.
[WARNING] /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/src/test/java/test/webservices/EPCPartTypeServiceTest.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ MyProjectDomain ---
[INFO] Surefire report directory: D:\JavaSoftware\workspace_frag2\FCO\MyProjectDomain\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running test.services.AccountRequestBaseSIDTest
[AppClassLoader@6da21389] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT
[AppClassLoader@6da21389] info register classloader sun.misc.Launcher$AppClassLoader@6da21389
[AppClassLoader@6da21389] info using configuration /D:/JavaSoftware/workspace_frag2/FCO/MyProjectDomain/target/classes/META-INF/aop.xml
[AppClassLoader@6da21389] info using configuration file:/C:/Users/tomw/.m2/repository/org/springframework/spring-aspects/4.1.6.RELEASE/spring-aspects-4.1.6.RELEASE.jar!/META-INF/aop.xml
[AppClassLoader@6da21389] info register aspect com.oreillyauto.aspects.HsqlSanitizer
[AppClassLoader@6da21389] info register aspect org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect
[AppClassLoader@6da21389] info register aspect org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect
[AppClassLoader@6da21389] info register aspect org.springframework.transaction.aspectj.AnnotationTransactionAspect
[AppClassLoader@6da21389] info register aspect org.springframework.cache.aspectj.AnnotationCacheAspect
[AppClassLoader@6da21389] info register aspect org.springframework.cache.aspectj.JCacheCacheAspect
[AppClassLoader@6da21389] error can't determine superclass of missing type org.springframework.cache.jcache.interceptor.JCacheAspectSupport
 [Xlint:cantFindType]
[AppClassLoader@6da21389] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
[AppClassLoader@6da21389] error can't determine annotations of missing type javax.cache.annotation.CachePut
when weaving type org.hsqldb.jdbc.JDBCDriver
when weaving classes
when weaving
 [Xlint:cantFindType]
[AppClassLoader@6da21389] error can't determine annotations of missing type javax.cache.annotation.CacheResult
when weaving type org.hsqldb.jdbc.JDBCDriver
when weaving classes
when weaving
 [Xlint:cantFindType]
[AppClassLoader@6da21389] error can't determine annotations of missing type javax.cache.annotation.CacheRemove
when weaving type org.hsqldb.jdbc.JDBCDriver
when weaving classes
when weaving
 [Xlint:cantFindType]
[AppClassLoader@6da21389] error can't determine annotations of missing type javax.cache.annotation.CacheRemoveAll
when weaving type org.hsqldb.jdbc.JDBCDriver
when weaving classes
when weaving
 [Xlint:cantFindType]
2015-07-06 13:46:23,776 WARN  [main] net.rubyeye.xmemcached.XMemcachedClient - XMemcachedClient use Text protocol
2015-07-06 13:46:24,080 WARN  [main] com.google.code.yanf4j.core.impl.AbstractController - The Controller started at localhost/127.0.0.1:0 ...
2015-07-06 13:46:24,178 WARN  [Xmemcached-Reactor-0] com.google.code.yanf4j.core.impl.AbstractController - Add a session: 172.18.10.41:11211
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.804 sec - in test.services.AccountRequestBaseSIDTest
2015-07-06 13:46:28,670 WARN  [Thread-12] com.google.code.yanf4j.core.impl.AbstractController - Remove a session: 172.18.10.41:11211

Results :

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.614 s
[INFO] Finished at: 2015-07-06T13:46:28-07:00
[INFO] Final Memory: 46M/1643M
[INFO] ------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:1)

这被证明是Maven构建问题,我们的其他开发人员之一引入了不同版本的springframework来运行。显然,javaagent编织的失败可能仅仅是由类路径上存在的不同版本引起的。啊。