create POM with junit 4

后端 未结 1 586
野的像风
野的像风 2021-01-02 09:13

I use Maven 3.0.4 and want to have junit 4 by default.

My projects are created with the command :
$>mvn archetype:create -DgroupId=my.group.id -DartifactId=m

相关标签:
1条回答
  • 2021-01-02 09:52

    A couple things:

    archetype:create is deprecated by archetype:generate; please use generate, it's interchangeable with create in your example.

    As for a solution, I'd say the simplest thing to do is generate your project, edit the pom to have the correct junit version; and then from within your project run:

    mvn archetype:create-from-project 
    

    Which will create an archetype based on your modifications, you simply need to install this with:

    cd target/generated-sources/archetype/
    mvn install
    

    Now you can create new maven projects with this new archetype as you like with:

    mvn archetype:generate -DgroupId=my.group.id -DartifactId=newArtifact -DpackageName=my.package.name -DarchetypeArtifactId=myArtifactId-archetype -DarchetypeGroupId=my.group.id
    

    Hopefully this helps.

    0 讨论(0)
提交回复
热议问题