public class ProjectClassPathModifier extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
addAntArtifacts(AntArtifact[] artifacts,
URI[] artifactElements,
FileObject projectArtifact,
String classPathType)
Adds artifacts (e.g.
|
static boolean |
addLibraries(Library[] libraries,
FileObject projectArtifact,
String classPathType)
Adds libraries into the project's classpath if the
libraries are not already included.
|
static boolean |
addProjects(Project[] projects,
FileObject projectArtifact,
String classPathType)
Adds projects into project's classpath if the
artifacts are not already on it.
|
static boolean |
addRoots(URI[] classPathRoots,
FileObject projectArtifact,
String classPathType)
Adds archive files or folders into the project's classpath if the
entries are not already there.
|
static boolean |
addRoots(URL[] classPathRoots,
FileObject projectArtifact,
String classPathType)
Adds archive files or folders into the project's classpath if the
entries are not already there.
|
static ProjectClassPathExtender |
extenderForModifier(Project p)
Similar to
ProjectClassPathModifier.extenderForModifier(ProjectClassPathModifierImplementation) but permits the new SPI to be created lazily. |
static ProjectClassPathExtender |
extenderForModifier(ProjectClassPathModifierImplementation pcpmi)
Translates the new SPI into an instance of the old SPI.
|
static boolean |
removeAntArtifacts(AntArtifact[] artifacts,
URI[] artifactElements,
FileObject projectArtifact,
String classPathType)
Removes artifacts (e.g.
|
static boolean |
removeLibraries(Library[] libraries,
FileObject projectArtifact,
String classPathType)
Removes libraries from the project's classpath if the
libraries are included on it.
|
static boolean |
removeRoots(URI[] classPathRoots,
FileObject projectArtifact,
String classPathType)
Removes archive files or folders from the project's classpath if the
entries are included on it.
|
static boolean |
removeRoots(URL[] classPathRoots,
FileObject projectArtifact,
String classPathType)
Removes archive files or folders from the project's classpath if the
entries are included on it.
|
public static boolean addLibraries(Library[] libraries, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
libraries
- to be addedprojectArtifact
- a file whose classpath should be extendedclassPathType
- the type of classpath to be extended, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
adding of a library to the classpath of the given type.public static boolean removeLibraries(Library[] libraries, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
libraries
- to be removedprojectArtifact
- a file from whose classpath the libraries should be removedclassPathType
- the type of classpath, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
removing of a library from the classpath of the given type.public static boolean addRoots(URL[] classPathRoots, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
classPathRoots
- roots to be added, each root has to be either a root of an archive or a folder urlprojectArtifact
- a file whose classpath should be extendedclassPathType
- the type of classpath to be extended, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
adding of a root to the classpath of the given type.public static boolean addRoots(URI[] classPathRoots, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
classPathRoots
- roots to be added, each root has to be either a root of an archive or a folder url; URI can be relativeprojectArtifact
- a file whose classpath should be extendedclassPathType
- the type of classpath to be extended, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
adding of a root to the classpath of the given type.public static boolean removeRoots(URL[] classPathRoots, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
classPathRoots
- roots to be removed, each root has to be either a root of an archive or a folderprojectArtifact
- a file from whose classpath the roots should be removedclassPathType
- the type of classpath, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
removing of a root from the classpath of the given type.public static boolean removeRoots(URI[] classPathRoots, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
classPathRoots
- roots to be removed, each root has to be either a root of an archive or a folder; URI can be relativeprojectArtifact
- a file from whose classpath the roots should be removedclassPathType
- the type of classpath, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
removing of a root from the classpath of the given type.public static boolean addAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
artifacts
- to be addedartifactElements
- the URIs of the build output, the artifactElements has to have the same length
as artifacts.
(must be owned by the artifact and be relative to it)projectArtifact
- a file whose classpath should be extendedclassPathType
- the type of classpath to be extended, @see ClassPathIOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
adding of an artifact to the classpath of the given type.public static boolean addProjects(Project[] projects, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
It's not guaranteed that the source and target project will connect in cases when each is of different class of project. Eg. Ant-based vs Maven project types. A way to check is to attempt to retrieve AntArtifact from the source and target projects..
projects
- to be addedprojectArtifact
- a file whose classpath should be extendedclassPathType
- the type of classpath to be extended, see ClassPath
IOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
adding of an artifact to the classpath of the given type.public static boolean removeAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, FileObject projectArtifact, String classPathType) throws IOException, UnsupportedOperationException
artifacts
- to be addedartifactElements
- the URIs of the build output, the artifactElements has to have the same length
as artifacts.
(must be owned by the artifact and be relative to it)projectArtifact
- a file from whose classpath the dependent projects should be removedclassPathType
- the type of classpath, ClassPath
IOException
- in case the project metadata cannot be changedUnsupportedOperationException
- is thrown when the project does not support
removing of an artifact from the classpath of the given type.public static ProjectClassPathExtender extenderForModifier(ProjectClassPathModifierImplementation pcpmi)
pcpmi
- the new SPIProjectClassPathModifier.extenderForModifier(Project)
public static ProjectClassPathExtender extenderForModifier(Project p)
ProjectClassPathModifier.extenderForModifier(ProjectClassPathModifierImplementation)
but permits the new SPI to be created lazily.
This is useful if the project is using LookupMergerSupport.createClassPathModifierMerger()
and it is thus impossible to get the final SPI instance
during construction of the project's lookup.
The new SPI is located at runtime on each call; if not present, false is returned from all methods.p
- a project whose lookup may contain a ProjectClassPathModifierImplementation