Deploy an artifact in legacy layout

"Legacy" is the layout used in maven 1 repositories while maven 2 uses "default". They are different in terms of directory structure, timestamp of snapshots in default and existence of metadata files in default.

  • legacy layout directory structure:
      groupId
      |--artifactId
         |--jars
            `--artifact
  • default layout directory structure:
      groupId
      |--artifactId
         |--version
         |  `---artifact
         |---metadata

    In able to deploy an artifact in a legacy layout of repository, set the repositoryLayout parameter to legacy value.

    mvn org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file -Durl=file:///C:/m2-repo \
                                                                                -DrepositoryId=some.id \
                                                                                -Dfile=your-artifact-1.0.jar \
                                                                                -DpomFile=your-pom.xml \
                                                                                -DrepositoryLayout=legacy

    Note: By using the fully qualified path of a goal, you're ensured to be using the preferred version of the maven-deploy-plugin. When using mvn deploy:deploy-file its version depends on its specification in the pom or the version of Apache Maven.