Class EclipseSourceDir

java.lang.Object
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$
Author:
Fabrizio Giustina
  • Constructor Details

    • 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 Details

    • 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:
    • hashCode

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

      public int compareTo(Object obj)
      Specified by:
      compareTo in interface Comparable
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • merge

      public boolean merge(EclipseSourceDir mergeWith) throws org.apache.maven.plugin.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:
      org.apache.maven.plugin.MojoExecutionException - test or filtering values are not identical, or isResource true and output are not identical