Maven deploy: forcing the deploy even if artifact already exists

前端 未结 3 1471
耶瑟儿~
耶瑟儿~ 2021-02-02 12:02

I\'m building a project, which is made up from several (sometimes unrelated) modules and some more non standard java modules (built with ANT).

Each maven module is deplo

3条回答
  •  情歌与酒
    2021-02-02 12:33

    It sounds like the middleware admins have configured your remote repo instance (Nexus or Artifactory or whatever) to not allow artifact redeployment, and as @khmarbaise says there are good reasons for that. Nexus can be configured to allow artifact deletion by users in a particular role or with artifact deletion privileges. If your admins have it set up that way perhaps you can request the delete privilege and remove the offending artifacts. Or, perhaps the Nexus admin will agree to do it for you.

    If neither of these is possible, here are some things to try which might keep this from happening in the future:

    1. If you are using the release plugin, do a dry run (-DdryRun=true on the release:prepare command line) first. Maven should report any errors without committing to SCM.
    2. Try running mvn install on your group of projects first. This will install the artifacts to your local repo, not the remote. If there's a problem you can whack the artifacts out of your local repo and start from scratch, repeating until you get a complete build.
    3. If you are running a multi-module build, there are command line options that allow resuming a Maven build from a particular project forward.
    4. Define -Dmaven.deploy.skip=true on the Maven command line. This is similar to suggestion #2, except Maven will actually load & configure the deploy plugin, it just won't do the actual deploy to the remote repo. Once everything works, remove the skip property.

提交回复
热议问题