Return-Path: Delivered-To: apmail-maven-dev-archive@www.apache.org Received: (qmail 43955 invoked from network); 6 Nov 2007 10:27:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2007 10:27:28 -0000 Received: (qmail 19569 invoked by uid 500); 6 Nov 2007 10:27:14 -0000 Delivered-To: apmail-maven-dev-archive@maven.apache.org Received: (qmail 19471 invoked by uid 500); 6 Nov 2007 10:27:14 -0000 Mailing-List: contact dev-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Developers List" Reply-To: "Maven Developers List" Delivered-To: mailing list dev@maven.apache.org Received: (qmail 19460 invoked by uid 99); 6 Nov 2007 10:27:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2007 02:27:14 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [63.246.20.110] (HELO mail.sonatype.com) (63.246.20.110) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2007 10:27:15 +0000 Received: (qmail 24279 invoked from network); 6 Nov 2007 10:26:55 -0000 Received: from c-67-160-251-50.hsd1.ca.comcast.net (HELO [10.0.1.199]) (jvanzyl@sonatype.com@[67.160.251.50]) (envelope-sender ) by mail.sonatype.com (qmail-ldap-1.03) with SMTP for ; 6 Nov 2007 10:26:55 -0000 Message-Id: <6F2768B7-4B56-4A5A-B9FC-4E16DB99CEBC@maven.org> From: Jason van Zyl To: "Maven Developers List" In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v912) Subject: Re: svn commit: r592346 - /maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java Date: Tue, 6 Nov 2007 02:26:54 -0800 References: <20071106091245.344C51A9832@eris.apache.org> <70153F58-C090-4E8D-A0C9-02298A54E3C3@apache.org> X-Mailer: Apple Mail (2.912) X-Virus-Checked: Checked by ClamAV on apache.org On 6 Nov 07, at 2:04 AM 6 Nov 07, Milos Kleint wrote: > Additionally when running 2 instances of the IDE (or different IDEs > at the > same time or running command line maven and embedded one) > concurrently, > they can clash and reuse the same dir/file? > > Can't we do a more predictable cleanup than deleteOnExit()? > I will clean up the artifact code so that I don't have to do that at all. You're right that two embedded instances won't work with the hack. Just running the ITs and I'll check in something nicer before I rip some more of maven-artifact apart. > Milos > > > > On 11/6/07, Brett Porter wrote: >> >> This wouldn't be thread safe in an embedded environment, would it? >> Couldn't File.createTempFile be used? >> >> - Brett >> >> On 06/11/2007, at 8:12 PM, jvanzyl@apache.org wrote: >> >>> Author: jvanzyl >>> Date: Tue Nov 6 01:12:35 2007 >>> New Revision: 592346 >>> >>> URL: http://svn.apache.org/viewvc?rev=592346&view=rev >>> Log: >>> o a fix for running in an embedded environment, the m2eclipse tests >>> bombed with the changes. >>> >>> Modified: >>> maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ >>> deployer/DefaultArtifactDeployer.java >>> >>> Modified: maven/artifact/trunk/src/main/java/org/apache/maven/ >>> artifact/deployer/DefaultArtifactDeployer.java >>> URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/ >>> java/org/apache/maven/artifact/deployer/ >>> DefaultArtifactDeployer.java? >>> rev=592346&r1=592345&r2=592346&view=diff >>> = >>> = >>> ==================================================================== >>> ======== >>> --- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ >>> deployer/DefaultArtifactDeployer.java (original) >>> +++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ >>> deployer/DefaultArtifactDeployer.java Tue Nov 6 01:12:35 2007 >>> @@ -125,6 +125,8 @@ >>> } >>> } >>> >>> + private static int i; >>> + >>> private boolean artifactHasBeenDeployed( Artifact artifact, >>> ArtifactRepository remoteRepository ) >>> throws ArtifactDeploymentException >>> { >>> @@ -132,9 +134,16 @@ >>> { >>> // We have to fake out the tools underneath as they >>> always expect a local repository. >>> // This makes sure that we are checking for remote >>> deployments not things cached locally >>> - // as we don't care about things cached locally. >>> - >>> - ArtifactRepository localRepository = new >>> DefaultArtifactRepository( "", "", defaultLayout ); >>> + // as we don't care about things cached locally. In an >>> embedded environment we have to >>> + // deal with multiple deployments, and the same >>> deployment by the same project so we >>> + // just need to make sure we have a detached local >>> repository each time as not to >>> + // get contaminated results. >>> + >>> + File detachedLocalRepository = new File >>> ( System.getProperty( "java.io.tmpdir" ), "repo" + i++ ); >>> + >>> + ArtifactRepository localRepository = new >>> DefaultArtifactRepository( "id", "file://" + >>> detachedLocalRepository, defaultLayout ); >>> + >>> + detachedLocalRepository.deleteOnExit(); >>> >>> // We will just let people deploy snapshots over and >>> over again even if they want >>> // to deploy something different with the same name. >>> @@ -153,7 +162,6 @@ >>> ArtifactRepositoryPolicy releasesPolicy = new >>> ArtifactRepositoryPolicy(); >>> >>> releasesPolicy.setEnabled( true ); >>> - >>> ((DefaultArtifactRepository ) >>> remoteRepository).setReleases( releasesPolicy ); >>> } >>> >>> >>> >> >> -- >> Brett Porter - brett@apache.org >> Blog: http://www.devzuz.org/blogs/bporter/ >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org >> For additional commands, e-mail: dev-help@maven.apache.org >> >> Thanks, Jason ---------------------------------------------------------- Jason van Zyl Founder, Apache Maven jason at sonatype dot com ---------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For additional commands, e-mail: dev-help@maven.apache.org