问题
I have maven projects and I want to deploy my artifacts on internal nexus repository which is configured to have my snapshots and releases on two separate places. So I can not use 'distributionManagement' as this would hardcode the location. So I have defined couple of in my settings.xml say 'releaseRepository' and 'snapshotRepository' and each have parameter 'release' which should be set to 'true' for releases and 'false' for snapshots.
I am running my build with following command to release my artifacts;
mvn clean deploy -DaltDeploymentRepository=releaseRepository::<DON'T KNOW WHAT GOES HERE SO LEFT IT EMPTY>::htp://abc.com/repositores/my-releases/ -Drelease=true
Now when I am running above command it fails because value for 'layout' is not provided and I get exception and build fails.
I couldn't find any information on what should be the value for 'layout', I have around 10 projects which I want to build and release after one another.
回答1:
altDeploymentRepository String - Specifies an alternative repository to which the project artifacts should be deployed ( other than those specified in <distributionManagement> ). Format: id::layout::url
(source)
So, in you case: releaseRepository::default::http://your.repo.url (see here for layout)
回答2:
"layout" is a legacy switch provided for backwards compatibility with Maven 1, and at this point an anachronism. If you are using Maven 2 or Maven 3 (as I believe at least 99.99% of the world must be at this point) it is indeed "default", as described elsewhere here. By stating that the answer is unequivocally "default", the question of the utility of the switch is obviated; if it is always "default", which does it still exist?
If you are actually using Maven 1 still, it should be "legacy", but I hope no one is. All this is describe in the Maven specifications:
layout Either default for the Maven2 layout or legacy for the Maven1 layout. Maven3 also uses the default layout.
https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html
来源:https://stackoverflow.com/questions/13547358/maven-deploydeploy-using-daltdeploymentrepository