Comportement différente entre Junit/Eclipse et Junit/Maven
Salut à tous,
J'ai une classe de test Junit quand je l'execute depuis Eclipse (Run as /Junit)
elle fonctionne parfaitement, mais quand je déploie l'application (via Jenkins)
le Maven lance cette classe de test avec échec
Code:
java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata
je suppose qu'il ne trouve pas une méthode issue de
Code:
org.springframework.beans.factory.annotation
sous Eclipse j'ai bien définie un USER Library que je reproduit dans le pom.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| <!-- Spring -->
<!-- org.springframework.beans-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.context-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.context.support-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.core-3.0.2.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
<!-- org.springframework.expression-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.jdbc-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.orm-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.oxm-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.test-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.transaction-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<!-- org.springframework.web-3.0.0.RELEASE.jar -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.0.RELEASE</version>
</dependency> |
et voilà la classe de test
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| /**
*
*/
package com.sys.test.dao;
import static org.junit.Assert.assertEquals;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import java.text.ParseException;
import com.sys.dao.BoxControlUnitDao;
import com.sys.dao.FactoryUnitDao;
import com.sys.model.BoxControlUnit;
import com.sys.model.FactoryUnit;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-TestUnit.xml")
//@ContextConfiguration("classpath:applicationContext.xml")
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false)
public class BoxUnitDaoTest
{
@Autowired
BoxControlUnitDao objBoxControlUnitDao;
@Autowired
FactoryUnitDao objFactoryUnitDao;
private Logger log = LoggerFactory.getLogger(BoxUnitDaoTest.class);
String boxToString = "";
String boxToJson = "";
String boxToXml = "";
@Test
public void testGetById()
{
log.info("*************Recherche par id***********************");
long productId = 2;
BoxControlUnit tmpBoxControlUnit = objBoxControlUnitDao.getBoxControlUnit(productId);
log.info(tmpBoxControlUnit.toJson());
log.info("*************fin de recehrche par id***********************");
}
} |
Pour préciser : j'ai pas mets les jar sous web-inf/lib
Merci de votre aide :ccool: