Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DFD5A10A7D for ; Thu, 15 Jan 2015 16:29:36 +0000 (UTC) Received: (qmail 53747 invoked by uid 500); 15 Jan 2015 16:29:37 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 53668 invoked by uid 500); 15 Jan 2015 16:29:37 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 53646 invoked by uid 99); 15 Jan 2015 16:29:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jan 2015 16:29:36 +0000 X-ASF-Spam-Status: No, hits=0.1 required=5.0 tests=MISSING_MID,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [162.253.144.89] (HELO relay.mailchannels.net) (162.253.144.89) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jan 2015 16:29:09 +0000 X-Sender-Id: wwwh|x-authuser|org.apache.maven.user+io7m.com@bs3-dallas.accountservergroup.com Received: from bs3-dallas.accountservergroup.com (ip-10-204-4-183.us-west-2.compute.internal [10.204.4.183]) by relay.mailchannels.net (Postfix) with ESMTPA id B7677121013 for ; Thu, 15 Jan 2015 16:24:09 +0000 (UTC) X-Sender-Id: wwwh|x-authuser|org.apache.maven.user+io7m.com@bs3-dallas.accountservergroup.com Received: from bs3-dallas.accountservergroup.com (bs3-dallas.accountservergroup.com [10.254.9.84]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.4.2); Thu, 15 Jan 2015 16:24:21 GMT X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|org.apache.maven.user+io7m.com@bs3-dallas.accountservergroup.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1421339054413:1744709162 X-MC-Ingress-Time: 1421339054413 Received: from dsl78-143-225-139.in-addr.fast.co.uk ([78.143.225.139]:63701 helo=viper.int.arc7.info) by bs3-dallas.accountservergroup.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1YBnDK-0008MG-QJ for users@maven.apache.org; Thu, 15 Jan 2015 10:24:07 -0600 Date: Thu, 15 Jan 2015 16:24:04 +0000 From: To: "Maven Users List" Subject: source-plugin vs, the initialize phase? MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: org.apache.maven.user+io7m.com@bs3-dallas.accountservergroup.com X-Virus-Checked: Checked by ClamAV on apache.org Message-Id: <20150115162915.94DDC816018@nike.apache.org> Hi. I have a custom plugin that inserts some extra files into the jars produced by the jar plugin. Because of the way the plugin works, it will fail if it tries to make the modifications to a jar file that has already had the modifications made. For reasons that aren't really relevant here, modifying the plugin to cope with jars that have been modified isn't feasible. The simplest way to resolve this issue seems to be to have the clean plugin delete any existing jar file unconditionally (so if the user doesn't specify "clean" on the command line, the module is cleaned anyway and the plugin doesn't have to receive an already-edited jar). Anyway, the following pom file unconditonally runs the clean plugin in the initialize phase: 4.0.0 com.io7m.example init-test 0.1.0 jar 3.0.3 UTF-8 UTF-8 maven-clean-plugin 2.5 auto-clean initialize clean org.apache.maven.plugins maven-source-plugin 2.2.1 package jar test-jar This would be fine, except that if you attempt to run the above pom with "mvn verify", the maven-source-plugin will cause the maven-clean-plugin to be executed twice: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building init-test 0.1.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (auto-clean) @ init-test --- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ init-test --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /tmp/sandbox/init-test/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ init-test --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ init-test --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /tmp/sandbox/init-test/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ init-test --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ init-test --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ init-test --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: /tmp/sandbox/init-test/target/init-test-0.1.0.jar [INFO] [INFO] >>> maven-source-plugin:2.2.1:jar (default) > generate-sources @ init-test >>> [INFO] [INFO] --- maven-clean-plugin:2.5:clean (auto-clean) @ init-test --- [INFO] Deleting /tmp/sandbox/init-test/target [INFO] [INFO] <<< maven-source-plugin:2.2.1:jar (default) < generate-sources @ init-test <<< [INFO] [INFO] --- maven-source-plugin:2.2.1:jar (default) @ init-test --- [INFO] No sources in project. Archive not created. [INFO] [INFO] >>> maven-source-plugin:2.2.1:test-jar (default) > generate-sources @ init-test >>> [INFO] [INFO] --- maven-clean-plugin:2.5:clean (auto-clean) @ init-test --- [INFO] [INFO] <<< maven-source-plugin:2.2.1:test-jar (default) < generate-sources @ init-test <<< [INFO] [INFO] --- maven-source-plugin:2.2.1:test-jar (default) @ init-test --- [INFO] No sources in project. Archive not created. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.925 s [INFO] Finished at: 2015-01-15T16:05:19+00:00 [INFO] Final Memory: 10M/228M [INFO] -------------------------------------------------------- Note how auto-clean appears three times! In practice, this means that auto-clean runs at the start of the build, and then is usually run again at some point after the maven-jar-plugin is executed, deleting the jar file. Is there any way to stop this from occurring? M --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org