[ 
http://jira.codehaus.org/browse/MNG-4093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=171428#action_171428
 ] 

Gin-Ting Chen commented on MNG-4093:
------------------------------------

Oh the fugly hacks that we must do

Using this in the maven ant task that deploys the jar works to preserve the 
local repository's integrity.
Ignore the ugliness (especially around the artifact path generation lol)
{code}
            final Reference ref = new Reference(project, "pom")
            final Pom pom = (Pom)ref.referencedObject;
            final String version = pom.getVersion()
            if(pom.getVersion().endsWith("SNAPSHOT")) {
                final File localRepoPath = pom.localRepository.path
                final String separator = project.getProperty("file.separator");
                final String fileGroup = pom.groupId.replace(".", 
project.getProperty("file.separator"))
                final String artifactId = pom.artifactId
                def artifact = "${separator}${artifactId}";
                artifact = 
"${localRepoPath.path}${separator}${fileGroup}${artifact}${separator}${version}${artifact}-${version}"
                
                ant.copy(
                    overwrite: true,
                    file: deployJar,
                    tofile: "${artifact}.jar"
                )
                ant.copy(
                    overwrite: true,
                    file: pomFile,
                    tofile: "${artifact}.pom"
                )
{code}

> SNAPSHOT jars not correctly updated
> -----------------------------------
>
>                 Key: MNG-4093
>                 URL: http://jira.codehaus.org/browse/MNG-4093
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0.10
>            Reporter: Gin-Ting Chen
>            Assignee: Brett Porter
>
> Occasionally I would get compilation errors after releasing a new SNAPSHOT 
> dependency of a project.
> After some debugging I found that it was adding a -SNAPSHOT.jar to my 
> classpath and not the actual timestamped jar.
> But I also found that, occasionally,  I would get this:
> {code}
> -rw-r--r-- 1 tich tich 1482491 common-util-25-20090313.151759-9.jar
> -rw-r--r-- 1 tich tich 1482490 common-util-25-20090317.001243-13.jar
> -rw-r--r-- 1 tich tich 1482491 common-util-25-SNAPSHOT.jar
> {code}
> It seems that the SNAPSHOT downloading process *silently* fails to update the 
> x-SNAPSHOT.jar.
> This behavior seems to occur randomly and can not be recovered from until you:
> * delete the corrupted local repository OR
> * release a new snapshot

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to