gpt4 book ai didi

java - eclipse 。手动运行测试并使用 "maven install"后的不同行为

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:53:22 25 4
gpt4 key购买 nike

我有 spring-mvc 项目。

如果在项目上单击鼠标右键,则:

enter image description here

我看到以下结果:

enter image description here

如果我这样点击: enter image description here

我看到下一条轨迹(很长):

 ...
**WARN : org.hibernate.engine.jdbc.internal.JdbcServicesImpl - HHH000342: Could not obtain connection to query metadata : Login failed for user 'root'.** ClientConnectionId:f27b5537-3406-4459-9ad5-2d6fa9c57aa4
...
Results :

Tests in error:
getAllCandidatesTest(com.epam.hhsystem.web.controllers.CandidateMenuControllerTest): com.epam.hhsystem.services.CandidateService.getAll()Ljava/util/Set;
getAllCandidates(com.epam.hhsystem.web.controllers.CandidateMenuControllerTest): com.epam.hhsystem.services.CandidateService.getAll()Ljava/util/Set;

...

这种行为的原因是什么?

更新

测试类之一

  @ContextConfiguration(locations = { "classpath:/test/BeanConfigUI.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class CandidateMenuControllerTest {
...
}

BeanConfigUI.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">


<!-- Включаем опцию использования конфигурационных аннотаций (@Annotation-based
configuration) -->
<context:annotation-config />
<mvc:annotation-driven />

<context:component-scan base-package="com.epam.hhsystem.jpa" />
<context:component-scan base-package="com.epam.hhsystem.services" />
<context:component-scan base-package="com.epam.hhsystem.web.controllers" />

<!-- Файл с настройками ресурсов для работы с данными (Data Access Resources) -->
<import resource="data.xml" />
<!-- <import resource="security_config.xml" /> -->


<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>

</beans>

数据.xml: ...

<!-- Настраивает управление транзакциями с помощью аннотации @Transactional -->
<tx:annotation-driven transaction-manager="transactionManager" />

<!-- Менеджер транзакций -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- Непосредственно бин dataSource -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
p:url="jdbc:sqlserver://10.16.9.52:1433;databaseName=hhsystemTest;"
p:username="userNew"
p:password="Pass12345" />

<!-- Настройки фабрики сессий Хибернейта -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:test/hibernate.cfg.xml</value>
</property>

<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.connection.charSet">UTF-8</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">create-drop</prop> -->
</props>
</property>
</bean>

</beans>

来自目标-> surefire-reports

-------------------------------------------------------------------------------
Test set: com.epam.hhsystem.web.controllers.CandidateMenuControllerTest
-------------------------------------------------------------------------------
Tests run: 9, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 5.813 sec <<< FAILURE!
getAllCandidatesTest(com.epam.hhsystem.web.controllers.CandidateMenuControllerTest) Time elapsed: 4.849 sec <<< ERROR!
java.lang.NoSuchMethodError: com.epam.hhsystem.services.CandidateService.getAll()Ljava/util/Set;
at com.epam.hhsystem.web.controllers.CandidateMenuControllerTest.getAllCandidatesTest(CandidateMenuControllerTest.java:95)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
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.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
getAllCandidates(com.epam.hhsystem.web.controllers.CandidateMenuControllerTest) Time elapsed: 0.089 sec <<< ERROR!
java.lang.NoSuchMethodError: com.epam.hhsystem.services.CandidateService.getAll()Ljava/util/Set;
at com.epam.hhsystem.web.controllers.CandidateMenuControllerTest.getAllCandidates(CandidateMenuControllerTest.java:136)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at
...

mvn dependency:tree 的结果

C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hhsystem ui 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ ui ---
[INFO] com.epam.hhs:ui:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework:spring-context:jar:3.2.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.3.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.3.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:3.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.1.3.RELEASE:compile
[INFO] | +- org.springframework:spring-jdbc:jar:3.0.7.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:3.0.7.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.1.3.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-acl:jar:3.1.3.RELEASE:compile
[INFO] +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.1.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.1.GA:compile
[INFO] | \- com.fasterxml:classmate:jar:0.8.0:compile
[INFO] +- com.epam.hhs:core:jar:1.0.9-SNAPSHOT:compile
[INFO] | +- org.mule.transports:mule-transport-http:jar:3.4.0:compile
[INFO] | | +- org.mule.transports:mule-transport-ssl:jar:3.4.0:compile
[INFO] | | | \- org.mule.transports:mule-transport-tcp:jar:3.4.0:compile
[INFO] | | | \- org.mule.modules:mule-module-spring-config:jar:3.4.0:compile
[INFO] | | | +- org.mule:mule-core:jar:3.4.0:compile
[INFO] | | | | +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] | | | | +- org.safehaus.jug:jug:jar:asl:2.0.0:compile
[INFO] | | | | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | | | | +- commons-io:commons-io:jar:1.4:compile
[INFO] | | | | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | | | | +- commons-pool:commons-pool:jar:1.5.3:compile
[INFO] | | | | +- javax.activation:activation:jar:1.1-osgi:compile
[INFO] | | | | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | | | | +- org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi:compile
[INFO] | | | | +- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] | | | | +- asm:asm:jar:3.1:compile
[INFO] | | | | +- asm:asm-commons:jar:3.1:compile
[INFO] | | | | | \- asm:asm-tree:jar:3.1:compile
[INFO] | | | | +- org.mvel:mvel2:jar:2.1.3.Final:compile
[INFO] | | | | +- org.jgrapht:jgrapht-jdk1.5:jar:0.7.3:compile
[INFO] | | | | \- org.mule.common:mule-common:jar:0.11.0:compile
[INFO] | | | +- org.mule.modules:mule-module-annotations:jar:3.4.0:compile
[INFO] | | | | \- cglib:cglib-nodep:jar:2.2:compile
[INFO] | | | \- jaxen:jaxen:jar:1.1.1:compile
[INFO] | | | \- jdom:jdom:jar:1.0:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.3-osgi:compile
[INFO] | | +- commons-httpclient:commons-httpclient:jar:3.1-osgi:compile
[INFO] | | +- tomcat:tomcat-util:jar:5.5.23:compile
[INFO] | | | \- tomcat:tomcat-apr:jar:5.5.23:compile
[INFO] | | +- org.samba.jcifs:jcifs:jar:1.3.3:compile
[INFO] | | \- joda-time:joda-time:jar:1.6:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.3.2.RELEASE:compile
[INFO] | | \- org.springframework.data:spring-data-commons:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework:spring-context-support:jar:3.2.3.RELEASE:compile
[INFO] | +- org.springframework:spring-orm:jar:3.2.3.RELEASE:compile
[INFO] | +- org.springframework:spring-oxm:jar:3.2.3.RELEASE:compile
[INFO] | +- org.springframework:spring-jms:jar:3.2.3.RELEASE:compile
[INFO] | +- org.apache.tomcat:tomcat-jdbc:jar:7.0.37:runtime
[INFO] | | \- org.apache.tomcat:tomcat-juli:jar:7.0.37:runtime
[INFO] | +- com.microsoft.sqlserver:sqljdbc4:jar:3.0:compile
[INFO] | +- org.hibernate:hibernate-core:jar:4.2.1.Final:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.2.1.Final:compile
[INFO] | +- org.hibernate:hibernate-ehcache:jar:4.2.1.Final:compile
[INFO] | | \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] | +- mysql:mysql-connector-java:jar:5.1.25:compile
[INFO] | +- org.webjars:bootstrap:jar:2.3.0:compile
[INFO] | +- org.webjars:jquery-ui:jar:1.9.2:compile
[INFO] | +- org.webjars:jquery:jar:1.9.0:compile
[INFO] | +- org.aspectj:aspectjweaver:jar:1.7.2:runtime
[INFO] | \- org.ow2.easybeans:easybeans-uberjar-eclipselink:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.spec.ee:ow2-jpa-2.0-spec:jar:1.0.3:compile
[INFO] | +- org.ow2.easybeans:easybeans-jpa-eclipselink-dependency:pom:1.2.0-M1:compile
[INFO] | | \- org.eclipse.persistence:eclipselink:jar:2.0.1:compile
[INFO] | +- org.ow2.easybeans:easybeans-jpa-default-eclipselink:jar:1.2.0-M1:compile
[INFO] | \- org.ow2.easybeans:easybeans-all:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-core:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.spec.ee:ow2-connector-1.5-spec:jar:1.0.3:compile
[INFO] | | +- org.ow2.util:util-log:jar:1.0.22:compile
[INFO] | | | +- org.ow2.util:util-i18n:jar:1.0.22:compile
[INFO] | | | \- commons-logging:commons-logging-api:jar:1.1:compile
[INFO] | | +- org.ow2.easybeans:easybeans-util:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.easybeans:easybeans-api:jar:1.2.0-M1:compile
[INFO] | | | +- org.ow2.spec.ee:ow2-ejb-3.0-spec:jar:1.0.3:compile
[INFO] | | | +- org.ow2.spec.ee:ow2-jpa-1.0-spec:jar:1.0.3:compile
[INFO] | | | +- org.ow2.util:util-ee-deploy-api:jar:1.0.22:compile
[INFO] | | | +- org.ow2.spec.ee:ow2-jsr77-1.1-spec:jar:1.0.3:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-jaxrpc_1.1_spec:jar:1.1:compile
[INFO] | | | +- javax.mail:mail:jar:1.4:compile
[INFO] | | | +- org.ow2.util:util-ee-metadata-common-api:jar:1.0.22:compile
[INFO] | | | \- org.ow2.util:util-pool-api:jar:1.0.22:compile
[INFO] | | +- org.ow2.easybeans:easybeans-jacc-provider:jar:1.2.0-M1:compile
[INFO] | | | \- org.apache.geronimo.specs:geronimo-jacc_1.1_spec:jar:1.0-M2:compile
[INFO] | | +- org.ow2.util:util-ee-deploy-impl:jar:1.0.22:compile
[INFO] | | | +- org.ow2.util:util-archive-impl:jar:1.0.22:compile
[INFO] | | | +- org.ow2.util:util-file:jar:1.0.22:compile
[INFO] | | | +- org.ow2.util:util-xml:jar:1.0.22:compile
[INFO] | | | +- org.ow2.util:util-plan-deploy-api:jar:1.0.22:compile
[INFO] | | | | \- org.ow2.util:util-plan-schemas:jar:1.0.22:compile
[INFO] | | | | \- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | | | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | | +- org.ow2.util.asm:asm:jar:3.1:compile
[INFO] | | | +- org.ow2.util.asm:asm-commons:jar:3.1:compile
[INFO] | | | | \- org.ow2.util.asm:asm-tree:jar:3.1:compile
[INFO] | | | \- org.ow2.util:util-execution:jar:1.0.22:compile
[INFO] | | +- org.ow2.util:util-pool-impl:jar:1.0.22:compile
[INFO] | | | \- org.ow2.util:util-scan-api:jar:1.0.22:compile
[INFO] | | +- org.ow2.util:util-pool-implenhanced:jar:1.0.22:compile
[INFO] | | | \- org.ow2.util:util-stream:jar:1.0.22:compile
[INFO] | | +- org.ow2.easybeans:easybeans-security:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.util:util-xmlconfig:jar:1.0.22:compile
[INFO] | | +- org.ow2.easybeans:easybeans-transaction:jar:1.2.0-M1:compile
[INFO] | | +- org.apache.tomcat:servlet-api:jar:6.0.13:compile
[INFO] | | +- org.ow2.easybeans:easybeans-asm:jar:3.0:compile
[INFO] | | +- org.ow2.easybeans:easybeans-asm-commons:jar:3.0:compile
[INFO] | | | \- org.ow2.easybeans:easybeans-asm-tree:jar:3.0:compile
[INFO] | | +- org.ow2.util:util-ee-metadata-ws-api:jar:1.0.22:compile
[INFO] | | +- jotm:jotm:jar:2.0.10:compile
[INFO] | | | +- jotm:jotm_jrmp_stubs:jar:2.0.10:compile
[INFO] | | | +- commons-logging:commons-logging:jar:1.0.3:compile
[INFO] | | | +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] | | | \- howl:howl-logger:jar:0.1.11:compile
[INFO] | | +- org.ow2.carol:carol:jar:3.0.8:compile
[INFO] | | | \- org.ow2.carol:carol-interceptors:jar:1.0.1:compile
[INFO] | | +- commons-modeler:commons-modeler:jar:2.0.1:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1:compile
[INFO] | | +- org.ow2.util:util-event-impl:jar:1.0.22:compile
[INFO] | | \- org.ow2.util:util-jmx-impl:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-management:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-jndi-resolver:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-carol:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-cmi:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.cmi:cmi-jgroups:jar:2.2.4:compile
[INFO] | | | +- org.ow2.cmi:cmi-api-client:jar:2.2.4:compile
[INFO] | | | | \- org.ow2.util:util-component-impl:jar:1.0.22:compile
[INFO] | | | +- org.ow2.cmi:cmi-core-common:jar:2.2.4:compile
[INFO] | | | +- org.ow2.cmi:cmi-core-server:jar:2.2.4:compile
[INFO] | | | | \- org.ow2.cmi:cmi-api-server:jar:2.2.4:compile
[INFO] | | | +- org.ow2.cmi:cmi-admin:jar:2.2.4:compile
[INFO] | | | +- org.ow2.util:util-cluster-jgroups:jar:1.0.22:compile
[INFO] | | | | \- jgroups:jgroups:jar:2.6.10.GA:compile
[INFO] | | | \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] | | +- org.ow2.cmi:cmi-jndi:jar:2.2.4:compile
[INFO] | | | +- org.ow2.cmi:cmi-rpc:jar:2.2.4:compile
[INFO] | | | | \- org.ow2.cmi:cmi-ejb2:jar:2.2.4:compile
[INFO] | | | | \- org.ow2.cmi:cmi-ha:jar:2.2.4:compile
[INFO] | | | +- org.ow2.cmi:cmi-core-client:jar:2.2.4:compile
[INFO] | | | \- org.ow2.cmi:cmi-lb:jar:2.2.4:compile
[INFO] | | +- org.ow2.util:util-event-api:jar:1.0.22:compile
[INFO] | | \- org.ow2.cmi:cmi-components-event:jar:2.2.4:compile
[INFO] | | \- org.ow2.util:util-component-api:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-deployment:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.util:util-scan-impl:jar:1.0.22:compile
[INFO] | | \- org.ow2.util:util-ee-metadata-ejbjar-impl:jar:1.0.22:compile
[INFO] | | +- org.ow2.util:util-ee-metadata-ejbjar-api:jar:1.0.22:compile
[INFO] | | +- org.ow2.util:util-ee-metadata-common-impl:jar:1.0.22:compile
[INFO] | | +- org.ow2.util:util-ee-metadata-ws-impl:jar:1.0.22:compile
[INFO] | | \- org.ow2.util:util-marshalling:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-hsqldb:jar:1.2.0-M1:compile
[INFO] | | \- hsqldb:hsqldb:jar:1.8.0.7:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-jdbcpool:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-jca-workmanager:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-joram:jar:1.2.0-M1:compile
[INFO] | | +- org.objectweb.joram:joram-mom:jar:5.3.0:compile
[INFO] | | +- org.objectweb.joram:joram-connector:jar:5.3.0:compile
[INFO] | | +- org.objectweb.joram:joram-client:jar:5.3.0:compile
[INFO] | | +- org.objectweb.joram:joram-shared:jar:5.3.0:compile
[INFO] | | +- org.objectweb.joram:jcup:jar:5.2.4:compile
[INFO] | | +- jakarta-regexp:jakarta-regexp:jar:1.4:compile
[INFO] | | +- org.objectweb.monolog:monolog:jar:2.1.12:compile
[INFO] | | +- org.objectweb.monolog:monolog-api:jar:2.1.12:compile
[INFO] | | \- org.objectweb.monolog:monolog-core:jar:2.1.12:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-jotm:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-quartz:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.easybeans:quartz:jar:1.6.0:compile
[INFO] | | \- commons-collections:commons-collections:jar:3.2:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-mail:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-remotejndiresolver:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-smartclient:jar:1.2.0-M1:compile
[INFO] | | \- org.ow2.easybeans:easybeans-component-smartclient-client:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-smartclient-server:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.easybeans:easybeans-component-smartclient-api:jar:1.2.0-M1:compile
[INFO] | | \- org.ow2.easybeans:easybeans-component-smartclient-common:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-depmonitor:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.util:util-url:jar:1.0.22:compile
[INFO] | | \- org.ow2.util:util-archive-api:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-event:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-jmx:jar:1.2.0-M1:compile
[INFO] | | \- org.ow2.util:util-jmx-api:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-statistic:jar:1.2.0-M1:compile
[INFO] | +- org.ow2.easybeans:easybeans-component-audit:jar:1.2.0-M1:compile
[INFO] | | +- org.ow2.util:audit-report-api:jar:1.0.22:compile
[INFO] | | \- org.ow2.util:audit-report-impl:jar:1.0.22:compile
[INFO] | +- org.ow2.easybeans:easybeans-jpa-openjpa-glue:jar:1.2.0-M1:compile
[INFO] | | \- org.ow2.spec.ee:ow2-jta-1.1-spec:jar:1.0.3:compile
[INFO] | +- org.ow2.easybeans:easybeans-jpa-toplink-essentials-glue:jar:1.2.0-M1:compile
[INFO] | \- org.ow2.easybeans:easybeans-jpa-eclipselink-glue:jar:1.2.0-M1:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.6.10:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.6:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.6:runtime (scope not updated to compile)
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.6:runtime (scope not updated to compile)
[INFO] +- log4j:log4j:jar:1.2.15:runtime (scope not updated to compile)
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5:compile
[INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:test
[INFO] \- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.672s
[INFO] Finished at: Mon Oct 14 19:36:39 MSK 2013
[INFO] Final Memory: 19M/308M
[INFO] ------------------------------------------------------------------------
C:\Users\Nikolay_Tkachev\workspace\HHSystem\UI>

问题已解决但无法理解

我有多模块 maven 项目 ui型号取决于 core模块

最初(然后我看到错误)

ui->pom.xml 我没有maven-surefire-plugin

核心->pom.xml:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
</plugin>

我的 Activity :

  • 添加到核心->pom.xml

    <forkMode>always</forkMode>

结果 - 不起作用

  • 添加到 ui->pom.xml(见此处取消显示注释)

    组织.apache.maven.plugins maven-surefire-插件 2.12

    总是

结果 - 不起作用

  • 更改核心->pom.xml

删除这个:

<includes>
<include>**/*Tests.java</include>
</includes>

结果 - 干得好

但是现在,如果我更改与 maven-surefire-plugin 连接的 pom.xml 中的某些内容(我可以从两个 pom.xml 中删除),这是很好的工作。这对我来说很奇怪。

最佳答案

我假设您正在运行来自 eclipse 和 maven 的所有测试(总共 9 个),这对于确保您的测试之间没有意外的交互很重要,并且一个测试会留下不一致的东西状态。

现在,如果上面的假设是正确的,那么下面的假设可能适用(这些来 self 的经验)。

1) 通常的罪魁祸首是 eclipse 没有使用与 maven 完全相同的类路径,这有时会导致 eclipse 中的错误,或者隐藏 maven 中的错误。

通常问题是类路径中存在相同 jar 的不兼容版本(作为一个非常通用的示例 spring-core 3.0.1.RELEASE 和 spring-beans 3.2.4.RELEASE)。

解决此问题的最简单方法是使用 TattleTale plugin报告哪些类在您的类路径中重复。更困难的方法是运行 mvn dependency:tree 并扫描是否有任何重复的库(即使是最近更改了组/Artifact ID 的库......例如 Spring)。

2) 另一种选择是更改 surefire 插件中的 fork 模式(最近更改了默认设置),并将其设置为 forkMode=always ( docs ),作为更新版本的插件重用 fork 。

关于java - eclipse 。手动运行测试并使用 "maven install"后的不同行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19313254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com