public class ArchetypeBuilder extends AbstractBuilder
mvn archetype:create-from-project
without dependencies to
maven-archetype related libraries.Modifier and Type | Field and Description |
---|---|
static String |
ARCHETYPE_RESOURCES_PATH |
static String |
ARCHETYPE_RESOURCES_XML |
static String |
FUNKTION_YML |
static org.slf4j.Logger |
LOG |
archetypeUtils, indent, indentSize
Constructor and Description |
---|
ArchetypeBuilder() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyCodeFiles(File rootPackage,
File outDir,
io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn)
Copies all java/groovy/kotlin/scala code recursively.
|
protected void |
copyFile(File src,
File dest,
io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn)
Copies single file from
src to dest . |
protected void |
copyFile(File src,
File dest,
io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn,
boolean isSource) |
protected void |
copyOtherFiles(File projectDir,
File srcDir,
File outDir,
io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn,
Set<String> extraIgnorefiles)
Copies all other source files which are not excluded
|
protected String |
defaultArchetypeXmlText() |
protected Node |
findChild(Element parent,
String n) |
protected void |
generateArchetype(File projectDir,
File projectPom,
File archetypeDir,
boolean clean,
List<String> dirs)
Generates Maven archetype from existing project.
|
protected void |
generateArchetypeFromGitRepo(File outputDir,
List<String> dirs,
File cloneParentDir,
String repoName,
String repoURL,
String tag) |
void |
generateArchetypes(String containerType,
File baseDir,
File outputDir,
boolean clean,
List<String> dirs)
Iterates through all nested directories and generates archetypes for all found, non-pom Maven projects.
|
void |
generateArchetypesFromGithubOrganisation(String githubOrg,
File outputDir,
List<String> dirs)
Iterates through all projects in the given github organisation and generates an archetype for it
|
void |
generateArchetypesFromGitRepoList(File file,
File outputDir,
List<String> dirs)
Iterates through all projects in the given properties file adn generate an archetype for it
|
protected File |
generatePomIfRequired(File archetypeDir,
String originalName,
String originalDescription) |
protected boolean |
isSourceFile(File file)
Returns true if this file is a valid source file name
|
protected boolean |
isSpecialPropertyName(String name)
Returns true if its a special property name such as Camel, ActiveMQ etc.
|
protected boolean |
isValidRequiredPropertyName(String name)
Returns true if this is a valid archetype property name, so excluding basedir and maven "project." names
|
protected Element |
replaceOrAddElementText(Document doc,
Element parent,
String name,
String content,
List<String> beforeNames)
Creates new element as child of
parent and sets its text content |
setIndentSize
public static org.slf4j.Logger LOG
public static final String ARCHETYPE_RESOURCES_PATH
public static final String ARCHETYPE_RESOURCES_XML
public static final String FUNKTION_YML
public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException
IOException
public void generateArchetypesFromGitRepoList(File file, File outputDir, List<String> dirs) throws IOException
IOException
protected void generateArchetypeFromGitRepo(File outputDir, List<String> dirs, File cloneParentDir, String repoName, String repoURL, String tag) throws IOException
IOException
public void generateArchetypes(String containerType, File baseDir, File outputDir, boolean clean, List<String> dirs) throws IOException
baseDir
- a directory to look for projects which may be converted to Maven ArchetypesoutputDir
- target directory where Maven Archetype projects will be generatedclean
- regenerate the archetypes (clean the archetype target dir)?IOException
protected void generateArchetype(File projectDir, File projectPom, File archetypeDir, boolean clean, List<String> dirs) throws IOException
mvn archetype:create-from-project
.projectDir
- directory of source project which will be converted to Maven ArchetypeprojectPom
- pom file of source projectarchetypeDir
- output directory where Maven Archetype project will be createdclean
- remove the archetypeDir entirely?IOException
protected File generatePomIfRequired(File archetypeDir, String originalName, String originalDescription) throws IOException
IOException
protected Element replaceOrAddElementText(Document doc, Element parent, String name, String content, List<String> beforeNames)
parent
and sets its text contentprotected void copyCodeFiles(File rootPackage, File outDir, io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn) throws IOException
replaceFn
is used to modify the content of files.IOException
protected void copyFile(File src, File dest, io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn) throws IOException
src
to dest
.
If the file is source file, variable references will be escaped, so they'll survive Velocity template merging.IOException
protected void copyFile(File src, File dest, io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn, boolean isSource) throws IOException
IOException
protected void copyOtherFiles(File projectDir, File srcDir, File outDir, io.fabric8.tooling.archetype.builder.ArchetypeBuilder.Replacement replaceFn, Set<String> extraIgnorefiles) throws IOException
IOException
protected boolean isSourceFile(File file)
protected boolean isValidRequiredPropertyName(String name)
protected boolean isSpecialPropertyName(String name)
protected String defaultArchetypeXmlText() throws IOException
IOException
Copyright © 2014–2018 Red Hat. All rights reserved.