public class ProjectGenerator extends Object
Modifier and Type | Method and Description |
---|---|
static AntProjectHelper |
createProject(FileObject directory,
String type)
Create a new Ant-based project on disk.
|
static AntProjectHelper |
createProject(FileObject directory,
String type,
String librariesDefinition)
See
createProject(FileObject, String) for more details. |
public static AntProjectHelper createProject(FileObject directory, String type) throws IOException, IllegalArgumentException
project.xml
.
It will be marked as modified.
In order to fill in various details of it, call normal methods on the returned
helper object, then save the project when you are done.
(You can use ProjectManager
to find the project object to be saved.)
No build-impl.xml
will be created immediately; once you save the project
changes, it will be created. If you wish to create a top-level build.xml
use GeneratedFilesHelper.generateBuildScriptFromStylesheet(java.lang.String, java.net.URL)
after
(or while) saving the project.
Acquires write access. But you are advised to acquire a write lock for
the entire operation of creating, configuring, and saving the new project,
and creating its initial build.xml
.
directory
- the main project directory to create it in
(see AntProjectHelper.getProjectDirectory()
)type
- a unique project type identifier (see AntBasedProjectType.getType()
)IOException
- if there is a problem physically creating the projectIllegalArgumentException
- if the project type does not match a registered
Ant-based project type factory or if the directory
is already recognized as some kind of project or if the
new project on disk is recognized by some other factorypublic static AntProjectHelper createProject(FileObject directory, String type, String librariesDefinition) throws IOException, IllegalArgumentException
createProject(FileObject, String)
for more details. This
method in addition allows to setup shared libraries locationdirectory
- the main project directory to create it in
(see AntProjectHelper.getProjectDirectory()
)type
- a unique project type identifier (see AntBasedProjectType.getType()
)librariesDefinition
- relative or absolute OS path; can be nullIOException
IllegalArgumentException