Question

When i am creating a new maven project in eclipse kepler, eclipse automatically adds junit 3.8 dependency in pom.xml like

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8</version>
    <scope>test</scope>
</dependency>

I want to be available newer version like: 4.10,

Where can i configure to use newer version instead of old?

Était-ce utile?

La solution

The junit version is described in archetype that is used to create maven project.

You need to either find archetype that will fit your needs, or create your own.

Then once you have it you need to select to use this archetype when creating the project in Eclipse.

Autres conseils

It's pretty common to have a company/product wide version of one of the following: -

  • A common parent pom with a dependency management section controlling all your versions
  • A common pom which is included as a dependency and imports all the testing dependencies, e.g., my-company-test. That can either include your common test code as well or be of type pom and just act as a dependency vacuum.
  • An archetype (as frant.hartm says) which defines all of your common dependency versions up front.

I would personally go with both the dependency based pom and an archetype which imports it.

You can always override versions if you need too.

You have to state the version that you want in the dependency, for example I use JUnit 4.11 in Eclipse Juno:

<dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.11</version>
   <scope>test</scope>
</dependency>

So you need to set your version to 4.10 or whatever version there is that you desire.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top