use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.
the class DefaultArchetypeArtifactManager method getArchetypeFile.
public File getArchetypeFile(final String groupId, final String artifactId, final String version, ArtifactRepository archetypeRepository, final ArtifactRepository localRepository, final List<ArtifactRepository> repositories, ProjectBuildingRequest buildingRequest) throws UnknownArchetype {
try {
File archetype = getArchetype(groupId, artifactId, version);
if (archetype == null) {
archetype = downloader.download(groupId, artifactId, version, archetypeRepository, localRepository, repositories, buildingRequest);
setArchetype(groupId, artifactId, version, archetype);
}
return archetype;
} catch (DownloadNotFoundException ex) {
throw new UnknownArchetype(ex);
} catch (DownloadException ex) {
throw new UnknownArchetype(ex);
}
}
use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.
the class DefaultArchetypeArtifactManager method isOldArchetype.
public boolean isOldArchetype(File archetypeFile) {
ZipFile zipFile = null;
try {
getLogger().debug("checking old archetype status on " + archetypeFile);
zipFile = getArchetypeZipFile(archetypeFile);
return isOldArchetype(zipFile);
} catch (IOException e) {
getLogger().debug(e.toString());
return false;
} catch (UnknownArchetype e) {
getLogger().debug(e.toString());
return false;
} finally {
if (zipFile != null) {
closeZipFile(zipFile);
}
}
}
use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.
the class DefaultArchetypeArtifactManager method getArchetypeJarLoader.
public ClassLoader getArchetypeJarLoader(File archetypeFile) throws UnknownArchetype {
try {
URL[] urls = new URL[1];
urls[0] = archetypeFile.toURI().toURL();
return new URLClassLoader(urls);
} catch (MalformedURLException e) {
throw new UnknownArchetype(e);
}
}
use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.
the class DefaultArchetypeArtifactManager method isFileSetArchetype.
public boolean isFileSetArchetype(File archetypeFile) {
ZipFile zipFile = null;
try {
getLogger().debug("checking fileset archetype status on " + archetypeFile);
zipFile = getArchetypeZipFile(archetypeFile);
return isFileSetArchetype(zipFile);
} catch (IOException e) {
getLogger().debug(e.toString());
return false;
} catch (UnknownArchetype e) {
getLogger().debug(e.toString());
return false;
} finally {
if (zipFile != null) {
closeZipFile(zipFile);
}
}
}
use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.
the class DefaultArchetypeArtifactManager method getPostGenerationScript.
public String getPostGenerationScript(File archetypeFile) throws UnknownArchetype {
ZipFile zipFile = null;
try {
zipFile = getArchetypeZipFile(archetypeFile);
Reader reader = getDescriptorReader(zipFile, Constants.ARCHETYPE_POST_GENERATION_SCRIPT);
return reader == null ? null : IOUtils.toString(reader);
} catch (IOException e) {
throw new UnknownArchetype(e);
} finally {
closeZipFile(zipFile);
}
}
Aggregations