Maven 2.x Dependency Plugin

change separators in build-classpath

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: build-classpath
  • Labels:
    None
  • Environment:
    Windows / Unix
  • Number of attachments :
    0

Description

Hi,
I'm trying to use the build-classpath to generate a unix-style classpath on a windows laptop (associated with the assembly plugin). I saw that you are using file.separator and path.separator to generate the classpath string but I'm affraid of side effect by overriding them in a properties file. Could you add a way to choose a style (windows|unix) or to override them in the plugin configuration?
thanks

Activity

Hide
Brian Fox added a comment -

i think i'll just add a parameter to override the default so you can separate with any string needed.

Show
Brian Fox added a comment - i think i'll just add a parameter to override the default so you can separate with any string needed.
Hide
Christophe Domas added a comment -

2 parameters (file.separator and path.separator) will be fine for me.

Thanks a lot.

Show
Christophe Domas added a comment - 2 parameters (file.separator and path.separator) will be fine for me. Thanks a lot.
Hide
Brian Fox added a comment -

snapshot deployed

Show
Brian Fox added a comment - snapshot deployed
Hide
David Biesack added a comment -

Are the options named file.separator and path.separator or fileSeparator pathSeparator as documented at
http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html which says

fileSeparator String Override the char used between the paths. This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\'. The default is File.separator

pathSeparator String Override the char used between path folders. The system-dependent path-separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'.

However, when I try those, they do not seem to work. On Windows, running maven 2.0.7,
I always get \ for the file separator char and : (not ; as documeted for Windows) for the path separator char.

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>build-classpath</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>build-classpath</goal>
            </goals>
            <configuration>
               <cpFile>${project.build.directory}/classpath.txt</cpFile>
               <regenerateFile>true</regenerateFile>
               <includeTypes>jar</includeTypes>
               <excludeClassifers>sources</excludeClassifers>
               <prefix>$M2_REPO</prefix>
               <pathSeparator>:</pathSeparator>
               <fileSeparator>/</fileSeparator>
            </configuration>
          </execution>
        </executions>
      </plugin>

I also tried

               <file.separator>/</file.separator>

with no change.

Show
David Biesack added a comment - Are the options named file.separator and path.separator or fileSeparator pathSeparator as documented at http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html which says fileSeparator String Override the char used between the paths. This field is initialized to contain the first character of the value of the system property file.separator. On UNIX systems the value of this field is '/'; on Microsoft Windows systems it is '\'. The default is File.separator pathSeparator String Override the char used between path folders. The system-dependent path-separator character. This field is initialized to contain the first character of the value of the system property path.separator. This character is used to separate filenames in a sequence of files given as a path list. On UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'. However, when I try those, they do not seem to work. On Windows, running maven 2.0.7, I always get \ for the file separator char and : (not ; as documeted for Windows) for the path separator char.
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>build-classpath</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>build-classpath</goal>
            </goals>
            <configuration>
               <cpFile>${project.build.directory}/classpath.txt</cpFile>
               <regenerateFile>true</regenerateFile>
               <includeTypes>jar</includeTypes>
               <excludeClassifers>sources</excludeClassifers>
               <prefix>$M2_REPO</prefix>
               <pathSeparator>:</pathSeparator>
               <fileSeparator>/</fileSeparator>
            </configuration>
          </execution>
        </executions>
      </plugin>
I also tried
               <file.separator>/</file.separator>
with no change.
Hide
Brian Fox added a comment -

Same comment as before, you need to get the snapshot plugin.

Show
Brian Fox added a comment - Same comment as before, you need to get the snapshot plugin.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
2h 30m
Time Spent - 2 hours, 30 minutes