Class Resource

All Implemented Interfaces:
Serializable, InputLocationTracker

This element describes all of the classpath resources associated with a project or unit tests.
See Also:
  • Method Details

    • getTargetPath

      public String getTargetPath()
      Describe the resource target path. The path is relative to the target/classes directory (i.e. ${project.build.outputDirectory}). For example, if you want that resource to appear in a specific package (org.apache.maven.messages), you must specify this element with this value: org/apache/maven/messages. This is not required if you simply put the resources in that directory structure at the source, however.
      Returns:
      a String
    • getFiltering

      public String getFiltering()
      Whether resources are filtered to replace tokens with parameterised values or not. The values are taken from the properties element and from the properties in the files listed in the filters element. Note: While the type of this field is String for technical reasons, the semantic type is actually Boolean. Default value is false.
      Returns:
      a String
    • getMergeId

      public String getMergeId()
      FOR INTERNAL USE ONLY. This is a unique identifier assigned to each resource to allow Maven to merge changes to this resource that take place during the execution of a plugin. This field must be managed by the generated parser and formatter classes in order to allow it to survive model interpolation.
      Returns:
      a String
    • getLocation

      public InputLocation getLocation(Object key)
      Gets the location of the specified field in the input source.
      Specified by:
      getLocation in interface InputLocationTracker
      Overrides:
      getLocation in class FileSet
    • with

      @Nonnull public Resource.Builder with()
      Creates a new builder with this object as the basis.
      Overrides:
      with in class FileSet
      Returns:
      a Builder
    • withIncludes

      @Nonnull public Resource withIncludes(Collection<String> includes)
      Creates a new Resource instance using the specified includes.
      Overrides:
      withIncludes in class FileSet
      Parameters:
      includes - the new Collection<String> to use
      Returns:
      a Resource with the specified includes
    • withExcludes

      @Nonnull public Resource withExcludes(Collection<String> excludes)
      Creates a new Resource instance using the specified excludes.
      Overrides:
      withExcludes in class FileSet
      Parameters:
      excludes - the new Collection<String> to use
      Returns:
      a Resource with the specified excludes
    • withDirectory

      @Nonnull public Resource withDirectory(String directory)
      Creates a new Resource instance using the specified directory.
      Overrides:
      withDirectory in class FileSet
      Parameters:
      directory - the new String to use
      Returns:
      a Resource with the specified directory
    • withTargetPath

      @Nonnull public Resource withTargetPath(String targetPath)
      Creates a new Resource instance using the specified targetPath.
      Parameters:
      targetPath - the new String to use
      Returns:
      a Resource with the specified targetPath
    • withFiltering

      @Nonnull public Resource withFiltering(String filtering)
      Creates a new Resource instance using the specified filtering.
      Parameters:
      filtering - the new String to use
      Returns:
      a Resource with the specified filtering
    • withMergeId

      @Nonnull public Resource withMergeId(String mergeId)
      Creates a new Resource instance using the specified mergeId.
      Parameters:
      mergeId - the new String to use
      Returns:
      a Resource with the specified mergeId
    • newInstance

      @Nonnull public static Resource newInstance()
      Creates a new Resource instance. Equivalent to newInstance( true ).
      Returns:
      a new Resource
      See Also:
    • newInstance

      @Nonnull public static Resource newInstance(boolean withDefaults)
      Creates a new Resource instance using default values or not. Equivalent to newBuilder( withDefaults ).build().
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Resource
    • newBuilder

      @Nonnull public static Resource.Builder newBuilder()
      Creates a new Resource builder instance. Equivalent to newBuilder( true ).
      Returns:
      a new Builder
      See Also:
    • newBuilder

      @Nonnull public static Resource.Builder newBuilder(boolean withDefaults)
      Creates a new Resource builder instance using default values or not.
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Resource.Builder newBuilder(Resource from)
      Creates a new Resource builder instance using the specified object as a basis. Equivalent to newBuilder( from, false ).
      Parameters:
      from - the Resource instance to use as a basis
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Resource.Builder newBuilder(Resource from, boolean forceCopy)
      Creates a new Resource builder instance using the specified object as a basis.
      Parameters:
      from - the Resource instance to use as a basis
      forceCopy - the boolean indicating if a copy should be forced
      Returns:
      a new Builder
    • isFiltering

      public boolean isFiltering()
    • toString

      public String toString()
      Overrides:
      toString in class FileSet
      See Also: