maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r592346 - /maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
Date Tue, 06 Nov 2007 09:32:17 GMT
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


Mime
View raw message