Vincent,

What's the use case for optional deployment?

On 24-Feb-08, at 11:34 AM, Olivier Lamy wrote:

Vincent Massol asked it for cargo build.

--
Olivier

2008/2/24, Jason van Zyl <[EMAIL PROTECTED]>:

On 24-Feb-08, at 10:57 AM, Olivier Lamy wrote:

My goal is only to help users which need some features in maven.
But if you say/think the feature is bad : No problem I can revert the
commit and mark the jira issue as won't fix.



What was the use case? I'm all for helping users, but generally they
give you their solution along with their problem and conflate what
they actually need with how it should actually be done. We take care
of not deploying when testing fails by stopping the lifecycle dead in
its tracks.

I'm just saying it appears to me not to be a good idea. Maybe it's a
great idea.

But almost any reason to have something like this means you're looking
or some success criteria. I vaguely remember someone in IRC asking
about it optional deployment for something in TeamCity. Is this the
case?


--
Olivier

2008/2/24, Jason van Zyl <[EMAIL PROTECTED]>:

On 22-Feb-08, at 2:57 PM, [EMAIL PROTECTED] wrote:

Author: olamy
Date: Fri Feb 22 14:57:35 2008
New Revision: 630347

URL: http://svn.apache.org/viewvc?rev=630347&view=rev
Log:
[MDEPLOY-63] Allow disabling deployment for artifacts that should
not be deployed


What's the reasoning behind this? When someone invokes the deploy
lifecycle one would assume you, in fact, want to deploy. Just become
some users asks for this doesn't mean it's a good idea.

By enabling this you potentially open a big can of worms. Now
deployment is exposed to potential bugs in profiles calculation,
property interpolation with dots, and the whole question of whether
deployment should be optional. And even though this is an addition to a plugin it is a major behavioral change. Given it's right at the end
of the lifecycle if you invoke it, it should deploy. I personally
don't think this is a great option, is of limited value, and is going
to create a potentially larger set of problems.


Modified:
 maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/
maven/plugin/deploy/DeployMojo.java
 maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/
maven/plugin/deploy/DeployMojoTest.java

Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/ org/
apache/maven/plugin/deploy/DeployMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployMojo.java?rev=630347&r1=630346&r2=630347&view=diff
=
=
=
=
=
=
=
=
=
=
= = ==================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/
apache/
maven/plugin/deploy/DeployMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/
apache/
maven/plugin/deploy/DeployMojo.java Fri Feb 22 14:57:35 2008
@@ -112,10 +112,25 @@
   * Contextualized.
   */
  private PlexusContainer container;
+
+    /**
+     * Set this to 'true' to bypass artifact deploy
+     *
+     * @parameter expression="${maven.deploy.skip}" default-
value="false"
+     * @since 2.4
+     */
+    private boolean skip;

  public void execute()
      throws MojoExecutionException, MojoFailureException
  {
+
+        if ( skip )
+        {
+            getLog().info( " skipping artifact deployement " );
+            return;
+        }
+
      ArtifactRepository repo = getDeploymentRepository();

      String protocol = repo.getProtocol();

Modified: maven/plugins/trunk/maven-deploy-plugin/src/test/java/ org/
apache/maven/plugin/deploy/DeployMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/apache/maven/plugin/deploy/DeployMojoTest.java?rev=630347&r1=630346&r2=630347&view=diff
=
=
=
=
=
=
=
=
=
=
= = ==================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/
apache/
maven/plugin/deploy/DeployMojoTest.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/test/java/org/
apache/
maven/plugin/deploy/DeployMojoTest.java Fri Feb 22 14:57:35 2008
@@ -193,6 +193,58 @@
      assertEquals( 0, getSizeOfExpectedFiles( fileList,
expectedFiles ) );
  }

+    public void testSkippingDeploy()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-
classes/
unit/basic-deploy-test/plugin-config.xml" );
+
+        DeployMojo mojo = (DeployMojo) lookupMojo( "deploy",
testPom );
+
+        assertNotNull( mojo );
+
+        File file = new File( getBasedir(), "target/test-classes/
unit/basic-deploy-test/target/"
+            + "deploy-test-file-1.0-SNAPSHOT.jar" );
+
+        assertTrue( file.exists() );
+
+        ArtifactRepository loc = (ArtifactRepository)
getVariableValueFromObject( mojo, "localRepository" );
+
+        artifact = (DeployArtifactStub)
getVariableValueFromObject( mojo, "artifact" );
+
+        String packaging = (String)
getVariableValueFromObject( mojo, "packaging" );
+
+        assertEquals( "jar", packaging );
+
+        artifact.setFile( file );
+
+        ArtifactRepositoryStub repo = (ArtifactRepositoryStub)
getVariableValueFromObject( mojo, "deploymentRepository" );
+
+        assertNotNull( repo );
+
+        repo.setAppendToUrl( "basic-deploy-test" );
+
+        assertEquals( "deploy-test", repo.getId() );
+        assertEquals( "deploy-test", repo.getKey() );
+        assertEquals( "file", repo.getProtocol() );
+        assertEquals( "file://" + getBasedir() + "/target/remote-
repo/basic-deploy-test", repo.getUrl() );
+
+        setVariableValueToObject( mojo, "skip", Boolean.TRUE );
+
+        mojo.execute();
+
+        File localRepo = new File( LOCAL_REPO, "" );
+
+        File[] files = localRepo.listFiles();
+
+        assertNull( files );
+
+        remoteRepo = new File( remoteRepo, "basic-deploy-test" );
+
+        files = remoteRepo.listFiles();
+
+        assertNull( files );
+    }
+
  public void testBasicDeployWithPackagingAsPom()
      throws Exception
  {



Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

the course of true love never did run smooth ...

-- Shakespeare




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

the course of true love never did run smooth ...

-- Shakespeare




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

the course of true love never did run smooth ...

-- Shakespeare



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to