org.apache.maven.plugin.eclipse
Class EclipseSourceDir

java.lang.Object
  extended by org.apache.maven.plugin.eclipse.EclipseSourceDir
All Implemented Interfaces:
Comparable

public class EclipseSourceDir
extends Object
implements Comparable

Represent an eclipse source dir. Eclipse has no "main", "test" or "resource" concepts, so two source dirs with the same path are equal.

source directories should always have a null output value.

Version:
$Id: EclipseSourceDir.java 1517906 2013-08-27 18:25:03Z krosenvold $
Author:
Fabrizio Giustina

Constructor Summary
EclipseSourceDir(String path, String output, boolean isResource, boolean test, List include, List exclude, boolean filtering)
           
 
Method Summary
 int compareTo(Object obj)
           
 boolean equals(Object obj)
           
 List getExclude()
          Getter for exclude.
 String getExcludeAsString()
           
 List getInclude()
          Getter for include.
 String getIncludeAsString()
           
 String getOutput()
          Getter for output.
 String getPath()
          Getter for path.
 int hashCode()
           
 boolean isFiltering()
          Wheter this resource should be copied with filtering.
 boolean isResource()
          Getter for isResource.
 boolean isTest()
          Getter for test.
 boolean merge(EclipseSourceDir mergeWith)
          Merge with the provided directory.
 void setExclude(List exclude)
          Setter for exclude.
 void setFiltering(boolean filtering)
          Wheter this resource should be copied with filtering.
 void setInclude(List include)
          Setter for include.
 void setOutput(String output)
          Setter for output.
 void setPath(String path)
          Setter for path.
 void setTest(boolean test)
          Setter for test.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EclipseSourceDir

public EclipseSourceDir(String path,
                        String output,
                        boolean isResource,
                        boolean test,
                        List include,
                        List exclude,
                        boolean filtering)
Parameters:
path - the eclipse source directory
output - path output directory
isResource - true if the directory only contains resources, false if a compilation directory
test - true if is a test directory, false otherwise
include - a string in the eclipse pattern format for the include filter
exclude - a string in the eclipse pattern format for the exclude filter
filtering - true if filtering should be applied, false otherwise. Note: Filtering will only be applied if this become a "special directory" by being nested within the default output directory.
Method Detail

getExclude

public List getExclude()
Getter for exclude.

Returns:
Returns the exclude. Never null.

setExclude

public void setExclude(List exclude)
Setter for exclude.

Parameters:
exclude - The exclude to set.

getInclude

public List getInclude()
Getter for include.

Returns:
Returns the include. Never null.

setInclude

public void setInclude(List include)
Setter for include.

Parameters:
include - The include to set.

getExcludeAsString

public String getExcludeAsString()
Returns:
Returns the exclude as a string pattern suitable for eclipse

getIncludeAsString

public String getIncludeAsString()
Returns:
Returns the include as a string pattern suitable for eclipse

getOutput

public String getOutput()
Getter for output.

source directories should always have a null output value.

Returns:
Returns the output.

setOutput

public void setOutput(String output)
Setter for output.

Parameters:
output - The output to set.

getPath

public String getPath()
Getter for path.

Returns:
Returns the path.

setPath

public void setPath(String path)
Setter for path. Converts \\ to / in path.

Parameters:
path - The path to set.

isTest

public boolean isTest()
Getter for test.

Returns:
Returns the test.

setTest

public void setTest(boolean test)
Setter for test.

Parameters:
test - The test to set.

isResource

public boolean isResource()
Getter for isResource.

Returns:
Returns the isResource.

isFiltering

public boolean isFiltering()
Wheter this resource should be copied with filtering.


setFiltering

public void setFiltering(boolean filtering)
Wheter this resource should be copied with filtering.

Parameters:
filtering - filter resources

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

compareTo

public int compareTo(Object obj)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()

Overrides:
toString in class Object

merge

public boolean merge(EclipseSourceDir mergeWith)
              throws MojoExecutionException
Merge with the provided directory.

If one directory is a source and the other is a resource directory then the result will be a source directory and any includes or excludes will be removed since Eclipse has no "main", "test" or "resource" concepts. The output directory will be the source directories value.

If the two directories are the same resources type (i.e isResource is equal) then the result will be the same resource type with the includes from each merged together (duplicates will be removed), similarly for the excludes. No effort is made to ensure that the includes and excludes are disjointed sets. Please fix your pom instead.

No support for cases where the test, or filtering values are not identical.

Parameters:
mergeWith - the directory to merge with
Throws:
MojoExecutionException - test or filtering values are not identical, or isResource true and output are not identical


Copyright © 2002–2015 The Apache Software Foundation. All rights reserved.