wow, nice idea! a little bit tricky, since the effective deploy is done ate end using the reactor as if it was a "post-execution aggegate" but definitely a nice idea
we need such an approach with scm-publish to be able to publish a multi-module site as part of site-deploy phase Regards, Hervé Le samedi 15 décembre 2012 13:14:49 [email protected] a écrit : > Author: rfscholte > Date: Sat Dec 15 13:14:44 2012 > New Revision: 1422245 > > URL: http://svn.apache.org/viewvc?rev=1422245&view=rev > Log: > [MDEPLOY-157] Add deployAtEnd option for multimodule projects > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/ > > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/invoker.p > roperties > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/module1/ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/module1/p > om.xml > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/pom.xml > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/verify.gr > oovy maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/module1/ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/module1/p > om.xml > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/pom.xml > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/verify.gr > oovy Modified: > maven/plugins/trunk/maven-deploy-plugin/pom.xml > > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/AbstractDeployMojo.java > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/DeployMojo.java > maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plug > in/deploy/DeployMojoTest.java > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-pom/plugin-config.xml > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-scp/plugin-config.xml > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-test/plugin-config.xml > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-with-attached-artifacts/plugin-config.xml > > Modified: maven/plugins/trunk/maven-deploy-plugin/pom.xml > URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/pom.xm > l?rev=1422245&r1=1422244&r2=1422245&view=diff > =========================================================================== > === --- maven/plugins/trunk/maven-deploy-plugin/pom.xml (original) > +++ maven/plugins/trunk/maven-deploy-plugin/pom.xml Sat Dec 15 13:14:44 2012 > @@ -155,8 +155,8 @@ under the License. > <artifactId>maven-invoker-plugin</artifactId> > <configuration> > <debug>true</debug> > - <projectsDirectory>src/it</projectsDirectory> > > <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + > <cloneClean>true</cloneClean> > <pomIncludes> > <pomInclude>*/pom.xml</pomInclude> > <pomInclude>*/non-default-pom.xml</pomInclude> > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/invoker.p > roperties URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-fail/invoker.properties?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/invoker.p > roperties (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/invoker.p > roperties Sat Dec 15 13:14:44 2012 @@ -0,0 +1 @@ > +invoker.buildResult=failure > \ No newline at end of file > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/module1/p > om.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-fail/module1/pom.xml?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/module1/p > om.xml (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/module1/p > om.xml Sat Dec 15 13:14:44 2012 @@ -0,0 +1,48 @@ > +<?xml version="1.0" encoding="UTF-8"?> > + > +<!-- Licensed to the Apache Software Foundation (ASF) under one or more > contributor + license agreements. See the NOTICE file distributed with > this work for additional + information regarding copyright ownership. The > ASF licenses this file to + you under the Apache License, Version 2.0 (the > "License"); you may not use + this file except in compliance with the > License. You may obtain a copy of + the License at > http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable > law or agreed to in writing, software distributed under the + License is > distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY > KIND, either express or implied. See the License for the specific + > language governing permissions and limitations under the License. --> + > +<project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> + > <modelVersion>4.0.0</modelVersion> > + > + <parent> > + <groupId>org.apache.maven.its.deploy.dae.fail</groupId> > + <artifactId>dae</artifactId> > + <version>1.0</version> > + </parent> > + <artifactId>module1</artifactId> > + > + <build> > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-enforcer-plugin</artifactId> > + <version>1.2</version> > + <executions> > + <execution> > + <id>enforce</id> > + <goals> > + <goal>enforce</goal> > + </goals> > + <configuration> > + <rules> > + <AlwaysFail /> > + </rules> > + </configuration> > + </execution> > + </executions> > + </plugin> > + </plugins> > + </build> > + > +</project> > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/pom.xml > URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-fail/pom.xml?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/pom.xml > (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/pom.xml > Sat Dec 15 13:14:44 2012 @@ -0,0 +1,100 @@ > +<?xml version="1.0" encoding="UTF-8"?> > + > +<!-- > +Licensed to the Apache Software Foundation (ASF) under one > +or more contributor license agreements. See the NOTICE file > +distributed with this work for additional information > +regarding copyright ownership. The ASF licenses this file > +to you under the Apache License, Version 2.0 (the > +"License"); you may not use this file except in compliance > +with the License. You may obtain a copy of the License at > + > + http://www.apache.org/licenses/LICENSE-2.0 > + > +Unless required by applicable law or agreed to in writing, > +software distributed under the License is distributed on an > +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > +KIND, either express or implied. See the License for the > +specific language governing permissions and limitations > +under the License. > +--> > + > +<project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> + > <modelVersion>4.0.0</modelVersion> > + > + <groupId>org.apache.maven.its.deploy.dae.fail</groupId> > + <artifactId>dae</artifactId> > + <version>1.0</version> > + <packaging>pom</packaging> > + > + <description> > + Tests deployment at end. > + </description> > + > + <properties> > + <maven.test.skip>true</maven.test.skip> > + </properties> > + > + <distributionManagement> > + <repository> > + <id>it</id> > + <url>file:///${basedir}/target/repo</url> > + <uniqueVersion>false</uniqueVersion> > + </repository> > + </distributionManagement> > + > + <build> > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-compiler-plugin</artifactId> > + <version>2.0.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-deploy-plugin</artifactId> > + <version>@project.version@</version> > + <configuration> > + <deployAtEnd>true</deployAtEnd> > + </configuration> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-install-plugin</artifactId> > + <version>2.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-jar-plugin</artifactId> > + <version>2.1</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-resources-plugin</artifactId> > + <version>2.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-source-plugin</artifactId> > + <version>2.0.4</version> > + <executions> > + <execution> > + <id>attach-sources</id> > + <goals> > + <goal>jar</goal> > + </goals> > + </execution> > + </executions> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-surefire-plugin</artifactId> > + <version>2.3.1</version> > + </plugin> > + </plugins> > + </build> > + > + <modules> > + <module>module1</module> > + </modules> > +</project> > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/verify.gr > oovy URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-fail/verify.groovy?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/verify.gr > oovy (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-fail/verify.gr > oovy Sat Dec 15 13:14:44 2012 @@ -0,0 +1,26 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +assert !( new File( basedir, > "target/repo/org/apache/maven/its/deploy/dae/fail/dae/1.0/dae-1.0.pom" > ).exists() ) +assert !( new File( basedir, > "module1/target/repo/org/apache/maven/its/deploy/dae/fail/module1/1.0/modul > e1-1.0.pom" ).exists() ) + > +File buildLog = new File( basedir, 'build.log' ) > +assert buildLog.exists() > +assert buildLog.text.contains( "[INFO] Deploying > org.apache.maven.its.deploy.dae.fail:dae:1.0 at end" ) + > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/module1/p > om.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-pass/module1/pom.xml?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/module1/p > om.xml (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/module1/p > om.xml Sat Dec 15 13:14:44 2012 @@ -0,0 +1,48 @@ > +<?xml version="1.0" encoding="UTF-8"?> > + > +<!-- Licensed to the Apache Software Foundation (ASF) under one or more > contributor + license agreements. See the NOTICE file distributed with > this work for additional + information regarding copyright ownership. The > ASF licenses this file to + you under the Apache License, Version 2.0 (the > "License"); you may not use + this file except in compliance with the > License. You may obtain a copy of + the License at > http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable > law or agreed to in writing, software distributed under the + License is > distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY > KIND, either express or implied. See the License for the specific + > language governing permissions and limitations under the License. --> + > +<project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> + > <modelVersion>4.0.0</modelVersion> > + > + <parent> > + <groupId>org.apache.maven.its.deploy.dae.pass</groupId> > + <artifactId>dae</artifactId> > + <version>1.0</version> > + </parent> > + <artifactId>module1</artifactId> > + > + <build> > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-enforcer-plugin</artifactId> > + <version>1.2</version> > + <executions> > + <execution> > + <id>enforce</id> > + <goals> > + <goal>enforce</goal> > + </goals> > + <configuration> > + <rules> > + <AlwaysPass /> > + </rules> > + </configuration> > + </execution> > + </executions> > + </plugin> > + </plugins> > + </build> > + > +</project> > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/pom.xml > URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-pass/pom.xml?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/pom.xml > (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/pom.xml > Sat Dec 15 13:14:44 2012 @@ -0,0 +1,100 @@ > +<?xml version="1.0" encoding="UTF-8"?> > + > +<!-- > +Licensed to the Apache Software Foundation (ASF) under one > +or more contributor license agreements. See the NOTICE file > +distributed with this work for additional information > +regarding copyright ownership. The ASF licenses this file > +to you under the Apache License, Version 2.0 (the > +"License"); you may not use this file except in compliance > +with the License. You may obtain a copy of the License at > + > + http://www.apache.org/licenses/LICENSE-2.0 > + > +Unless required by applicable law or agreed to in writing, > +software distributed under the License is distributed on an > +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > +KIND, either express or implied. See the License for the > +specific language governing permissions and limitations > +under the License. > +--> > + > +<project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> + > <modelVersion>4.0.0</modelVersion> > + > + <groupId>org.apache.maven.its.deploy.dae.pass</groupId> > + <artifactId>dae</artifactId> > + <version>1.0</version> > + <packaging>pom</packaging> > + > + <description> > + Tests deployment at end. > + </description> > + > + <properties> > + <maven.test.skip>true</maven.test.skip> > + </properties> > + > + <distributionManagement> > + <repository> > + <id>it</id> > + <url>file:///${basedir}/target/repo</url> > + <uniqueVersion>false</uniqueVersion> > + </repository> > + </distributionManagement> > + > + <build> > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-compiler-plugin</artifactId> > + <version>2.0.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-deploy-plugin</artifactId> > + <version>@project.version@</version> > + <configuration> > + <deployAtEnd>true</deployAtEnd> > + </configuration> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-install-plugin</artifactId> > + <version>2.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-jar-plugin</artifactId> > + <version>2.1</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-resources-plugin</artifactId> > + <version>2.2</version> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-source-plugin</artifactId> > + <version>2.0.4</version> > + <executions> > + <execution> > + <id>attach-sources</id> > + <goals> > + <goal>jar</goal> > + </goals> > + </execution> > + </executions> > + </plugin> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-surefire-plugin</artifactId> > + <version>2.3.1</version> > + </plugin> > + </plugins> > + </build> > + > + <modules> > + <module>module1</module> > + </modules> > +</project> > > Added: > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/verify.gr > oovy URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it > /deploy-at-end-pass/verify.groovy?rev=1422245&view=auto > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/verify.gr > oovy (added) +++ > maven/plugins/trunk/maven-deploy-plugin/src/it/deploy-at-end-pass/verify.gr > oovy Sat Dec 15 13:14:44 2012 @@ -0,0 +1,26 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +assert new File( basedir, > "target/repo/org/apache/maven/its/deploy/dae/pass/dae/1.0/dae-1.0.pom" > ).exists() +assert new File( basedir, > "module1/target/repo/org/apache/maven/its/deploy/dae/pass/module1/1.0/modul > e1-1.0.pom" ).exists() + > +File buildLog = new File( basedir, 'build.log' ) > +assert buildLog.exists() > +assert buildLog.text.contains( "[INFO] Deploying > org.apache.maven.its.deploy.dae.pass:dae:1.0 at end" ) + > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/AbstractDeployMojo.java URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/ma > in/java/org/apache/maven/plugin/deploy/AbstractDeployMojo.java?rev=1422245&r > 1=1422244&r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/AbstractDeployMojo.java (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/AbstractDeployMojo.java Sat Dec 15 13:14:44 2012 @@ -48,16 +48,12 > @@ public abstract class AbstractDeployMojo > > /** > * Component used to create an artifact. > - * > - * @component > */ > @Component > protected ArtifactFactory artifactFactory; > > /** > * Component used to create a repository. > - * > - * @component > */ > @Component > ArtifactRepositoryFactory repositoryFactory; > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/DeployMojo.java URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/ma > in/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=1422245&r1=142224 > 4&r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/DeployMojo.java (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plug > in/deploy/DeployMojo.java Sat Dec 15 13:14:44 2012 @@ -57,18 +57,33 @@ > public class DeployMojo > */ > @Component > private MavenProject project; > + > + @Parameter( defaultValue = "${reactorProjects}", required = true, > readonly = true ) + private List<MavenProject> reactorProjects; > + > + /** > + * Whether every project should be deployed during its own deploy-phase > or at the end of the multimodule build. + * If set to {@code true} and > the build fails, none of the reactor projects is deployed + * > + * @since 2.8 > + */ > + @Parameter( defaultValue = "false", property = "deployAtEnd" ) > + private boolean deployAtEnd; > > /** > + * @deprecated either use project.getArtifact() or > reactorProjects.get(i).getArtifact() */ > @Parameter( defaultValue = "${project.artifact}", required = true, > readonly = true ) private Artifact artifact; > > /** > + * @deprecated either use project.getPackaging() or > reactorProjects.get(i).getPackaging() */ > @Parameter( defaultValue = "${project.packaging}", required = true, > readonly = true ) private String packaging; > > /** > + * @deprecated either use project.getFile() or > reactorProjects.get(i).getFile() */ > @Parameter( defaultValue = "${project.file}", required = true, readonly > = true ) private File pomFile; > @@ -83,6 +98,7 @@ public class DeployMojo > private String altDeploymentRepository; > > /** > + * @deprecated either use project.getAttachedArtifacts() or > reactorProjects.get(i).getAttachedArtifacts() */ > @Parameter( defaultValue = "${project.attachedArtifacts}", required = > true, readonly = true ) private List attachedArtifacts; > @@ -105,8 +121,38 @@ public class DeployMojo > } > > failIfOffline(); > + > + if( !deployAtEnd ) > + { > + deployProject( project ); > + } > + else > + { > + MavenProject lastProject = reactorProjects.get( > reactorProjects.size() - 1 ); + if( lastProject.equals( project > ) ) > + { > + for( MavenProject reactorProject : reactorProjects ) > + { > + deployProject( reactorProject ); > + } > + } > + else > + { > + getLog().info( "Deploying " + project.getGroupId() + ":" + > project.getArtifactId() + + ":" + > project.getVersion() + " at end" ); + } > + } > + } > > - ArtifactRepository repo = getDeploymentRepository(); > + private void deployProject( MavenProject project ) > + throws MojoExecutionException, MojoFailureException > + { > + Artifact artifact = project.getArtifact(); > + String packaging = project.getPackaging(); > + File pomFile = project.getFile(); > + List attachedArtifacts = project.getAttachedArtifacts(); > + > + ArtifactRepository repo = getDeploymentRepository( project ); > > String protocol = repo.getProtocol(); > > @@ -119,6 +165,7 @@ public class DeployMojo > sshFile.mkdirs(); > } > } > + > > // Deploy the POM > boolean isPomArtifact = "pom".equals( packaging ); > @@ -185,7 +232,7 @@ public class DeployMojo > } > } > > - private ArtifactRepository getDeploymentRepository() > + private ArtifactRepository getDeploymentRepository( MavenProject > project ) throws MojoExecutionException, MojoFailureException > { > ArtifactRepository repo = null; > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plug > in/deploy/DeployMojoTest.java URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/te > st/java/org/apache/maven/plugin/deploy/DeployMojoTest.java?rev=1422245&r1=14 > 22244&r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plug > in/deploy/DeployMojoTest.java (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plug > in/deploy/DeployMojoTest.java Sat Dec 15 13:14:44 2012 @@ -114,7 +114,9 @@ > public class DeployMojoTest > > assertTrue( file.exists() ); > > - artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = ( DeployArtifactStub ) project.getArtifact(); > > String packaging = ( String ) getVariableValueFromObject( mojo, > "packaging" ); > > @@ -216,7 +218,9 @@ public class DeployMojoTest > > assertTrue( file.exists() ); > > - artifact = (DeployArtifactStub) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > String packaging = (String) getVariableValueFromObject( mojo, > "packaging" ); > > @@ -266,7 +270,9 @@ public class DeployMojoTest > > assertEquals( "pom", packaging ); > > - artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > artifact.setArtifactHandlerExtension( packaging ); > > @@ -323,7 +329,9 @@ public class DeployMojoTest > > assertTrue( updateReleaseInfo ); > > - artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > artifact.setFile( testPom ); > > @@ -346,7 +354,9 @@ public class DeployMojoTest > > assertNotNull( mojo ); > > - artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > artifact.setFile( null ); > > @@ -375,7 +385,9 @@ public class DeployMojoTest > > assertNotNull( mojo ); > > - artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, > "artifact" ); + MavenProject project = (MavenProject) > getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > File file = new File( getBasedir(), > > "target/test-classes/unit/basic-deploy-with-attached-artifacts/target/" + > @@ -489,7 +501,9 @@ public class DeployMojoTest > > assertTrue( file.exists() ); > > - DeployArtifactStub artifact = ( DeployArtifactStub ) > getVariableValueFromObject( mojo, "artifact" ); + MavenProject > project = (MavenProject) getVariableValueFromObject( mojo, "project" ); + > + artifact = (DeployArtifactStub) project.getArtifact(); > > artifact.setFile( file ); > > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-pom/plugin-config.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/te > st/resources/unit/basic-deploy-pom/plugin-config.xml?rev=1422245&r1=1422244& > r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-pom/plugin-config.xml (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-pom/plugin-config.xml Sat Dec 15 13:14:44 2012 @@ -23,12 +23,18 @@ under > the License. > <plugin> > <artifactId>maven-deploy-plugin</artifactId> > <configuration> > + <!-- derecated fields --> > > <pomFile>${basedir}/src/test/resources/unit/basic-deploy-pom/plugin-config. > xml</pomFile> <packaging>pom</packaging> > <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > <attachedArtifacts /> > + > <localRepository>${localRepository}</localRepository> > <project > implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub"> + > > <file>${basedir}/src/test/resources/unit/basic-deploy-pom/plugin-config.xml > </file> + <packaging>pom</packaging> > + <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > + <attachedArtifacts /> > <deploymentRepository > implementation="org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub > " /> </project> > <updateReleaseInfo>true</updateReleaseInfo> > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-scp/plugin-config.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/te > st/resources/unit/basic-deploy-scp/plugin-config.xml?rev=1422245&r1=1422244& > r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-scp/plugin-config.xml (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-scp/plugin-config.xml Sat Dec 15 13:14:44 2012 @@ -23,12 +23,18 @@ under > the License. > <plugin> > <artifactId>maven-deploy-plugin</artifactId> > <configuration> > + <!-- deprecated fields --> > > <pomFile>${basedir}/src/test/resources/unit/basic-deploy-scp/plugin-config. > xml</pomFile> <packaging>jar</packaging> > <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > <attachedArtifacts /> > + > <localRepository>${localRepository}</localRepository> > <project > implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub"> + > > <file>${basedir}/src/test/resources/unit/basic-deploy-scp/plugin-config.xml > </file> + <packaging>jar</packaging> > + <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > + <attachedArtifacts /> > <deploymentRepository > implementation="org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub > 2" /> </project> > <updateReleaseInfo>false</updateReleaseInfo> > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-test/plugin-config.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/te > st/resources/unit/basic-deploy-test/plugin-config.xml?rev=1422245&r1=1422244 > &r2=1422245&view=diff > =========================================================================== > === Binary files - no diff available. > > Modified: > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-with-attached-artifacts/plugin-config.xml URL: > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/te > st/resources/unit/basic-deploy-with-attached-artifacts/plugin-config.xml?rev > =1422245&r1=1422244&r2=1422245&view=diff > =========================================================================== > === --- > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-with-attached-artifacts/plugin-config.xml (original) +++ > maven/plugins/trunk/maven-deploy-plugin/src/test/resources/unit/basic-deplo > y-with-attached-artifacts/plugin-config.xml Sat Dec 15 13:14:44 2012 @@ > -23,14 +23,22 @@ under the License. > <plugin> > <artifactId>maven-deploy-plugin</artifactId> > <configuration> > + <!-- deprecated fields --> > > <pomFile>${basedir}/src/test/resources/unit/basic-deploy-with-attached-arti > facts/plugin-config.xml</pomFile> <packaging>jar</packaging> > <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > <attachedArtifacts> > <attachedArtifact > implementation="org.apache.maven.plugin.deploy.stubs.AttachedArtifactStub" > /> </attachedArtifacts> > + > <localRepository>${localRepository}</localRepository> > - <project > implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub"> + > <project > implementation="org.apache.maven.plugin.deploy.stubs.MavenProjectStub"> + > > <file>${basedir}/src/test/resources/unit/basic-deploy-with-attached-artifac > ts/plugin-config.xml</file> + <packaging>jar</packaging> > + <artifact > implementation="org.apache.maven.plugin.deploy.stubs.DeployArtifactStub" /> > + <attachedArtifacts> > + <attachedArtifact > implementation="org.apache.maven.plugin.deploy.stubs.AttachedArtifactStub" > /> + </attachedArtifacts> > <deploymentRepository > implementation="org.apache.maven.plugin.deploy.stubs.ArtifactRepositoryStub > " /> </project> > <updateReleaseInfo>true</updateReleaseInfo> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
