The following comment has been added to this issue:

     Author: Marc Portier
    Created: Mon, 20 Oct 2003 4:32 PM
       Body:
Am lacking the time to test the patched stuff ATM, just some status report from my 
side: 

I'm with dion about the need for the relativation code inside the artifact plugin to 
make sure the 'c:' confusion on windows-based scp is avoided.
(so fixing this would require an additional patch to the artifact plugin IMHO)

In preparation of that remaining patch I wrote up the earlier proposed 'relativation' 
process in Java-code.  While I need more time (and lack it ATM) to learn how to 
jelly-fy this, some others might pick it up and get the job done...

public class FileUtil {

    public static String makeRelativeTargetPath(String base, 
                                                String target) {
        // should we throw exception if base is not absolute?
        // if target is not absolute --> pretend it is relative
        if ( !new File(target).isAbsolute()) {
            return target;
        }

        StringBuffer relativePath = new StringBuffer();
        
        String normTarget = target.replace('\\', '/');
        StringTokenizer targetTokens = 
            new StringTokenizer(normTarget, "/");
        
        String normBase = base.replace('\\', '/');      
        StringTokenizer baseTokens = 
            new StringTokenizer(normBase, "/");
                
        String nextBasePart, nextTargetPart = null;
        boolean partsStillEqual = true;
        boolean noMoreTargetParts = false;
        while ( baseTokens.hasMoreTokens() ) {
            nextBasePart = baseTokens.nextToken();
            if (partsStillEqual) {
                // ignore equal parts
                if (targetTokens.hasMoreTokens()) {
                    nextTargetPart = targetTokens.nextToken();
                    if (!nextBasePart.equals(nextTargetPart)) {
                        partsStillEqual = false;
                    }
                } else {
                    noMoreTargetParts = true;
                    nextTargetPart = null;
                }
            } else {
                // relativise parts from first different
                relativePath.append("../");   
            }                            
        }
        
        //append remaining target parts
        if (!noMoreTargetParts) {
            if (!partsStillEqual) {
                relativePath.append(nextTargetPart).append('/');
            }
            while (targetTokens.hasMoreTokens()) {
                relativePath.append(
                    targetTokens.nextToken()).append('/');
            }
        }
        
        // pitch of last slash
        relativePath.setLength(relativePath.length()-1);
        return relativePath.toString();
    }
}




---------------------------------------------------------------------
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-373


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-373
    Summary: Incorrect arguments in jar:deploy and jar:deploy-snapshot
       Type: Bug

     Status: Unassigned
   Priority: Major

 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
 Components: 
             plugin-java
   Fix Fors:
             1.1
   Versions:
             1.0-beta-9

   Assignee: 
   Reporter: Aslak Hellesoy

    Created: Fri, 4 Apr 2003 6:31 AM
    Updated: Mon, 20 Oct 2003 2:04 AM

Description:
The jar:deploy and jar:deploy-snapshot goals are doing some fancy and unnecessary 
string manipulations to find the relative file name of the jar file to deploy.

This is unnecessary (the file name of the jars can be absolute), and furhter, it 
doesn't work when ${maven.build.dir} is overridden to point outside the project.

Further, the jar:deploy-snapshot could just call the jar:deploy goal (and avoid 
copy-paste of identical logic).

The mentioned goals should be simplified as follows:

  <!-- ================================================================== -->
  <!-- D E P L O Y  S N A P S H O T                                       -->
  <!-- ================================================================== -->

  <goal
    name="jar:deploy-snapshot"
    description="Deploy a snapshot jar to the remote repository">

    <m:user-check user="${maven.username}"/>
    <attainGoal name="jar:snapshot"/>
    <attainGoal name="jar:deploy"/>
                    
  </goal>

  <!-- ================================================================== -->
  <!-- D E P L O Y  J A R                                                 -->
  <!-- ================================================================== -->

  <goal
    name="jar:deploy"
    description="Deploy a jar to the remote repository">

    <m:user-check user="${maven.username}"/>
    <attainGoal name="java:jar"/>
    <ant:property name="maven.jar.to.deploy" value="${maven.final.name}.jar"/>
    <deploy:artifact
      artifact="${maven.final.name}.jar"
      type="jars"
      assureDirectoryCommand="mkdir -p"
      siteCommand="cd @deployDirectory@; chmod g+w ${maven.jar.to.deploy}; chgrp maven 
${maven.jar.to.deploy}"
    />

  </goal>



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to