if (!archetypeArtifactManager.exists(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories)) { throw new UnknownArchetype("The desired archetype does not exist (" + ad.getGroupId() + ":" + ad.getArtifactId() + ":" + ad.getVersion() + ")");
private File getArchetypeFile( ArchetypeGenerationRequest request, ArtifactRepository localRepository ) throws IOException, ArchetypeException, XmlPullParserException, DocumentException { if ( !isArchetypeDefined( request ) ) { throw new ArchetypeNotDefined( "The archetype is not defined" ); } List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>(); ArtifactRepository remoteRepo = null; if ( request != null && request.getArchetypeRepository() != null ) { remoteRepo = createRepository( request.getArchetypeRepository(), request.getArchetypeArtifactId() + "-repo" ); repos.add( remoteRepo ); } if ( !archetypeArtifactManager.exists( request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(), remoteRepo, localRepository, repos, request.getProjectBuildingRequest() ) ) { throw new UnknownArchetype( "The desired archetype does not exist (" + request.getArchetypeGroupId() + ":" + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion() + ")" ); } File archetypeFile = archetypeArtifactManager.getArchetypeFile( request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(), remoteRepo, localRepository, repos, request.getProjectBuildingRequest() ); return archetypeFile; }
private void generateArchetype(ArchetypeGenerationRequest request, ArtifactRepository localRepository, String basedir) throws Exception { assert request != null; if (!isArchetypeDefined(request)) { throw new ArchetypeNotDefined("The archetype is not defined"); } List<ArtifactRepository> repos=new ArrayList<ArtifactRepository>(); ArtifactRepository remoteRepo=null; if (request.getArchetypeRepository() != null) { remoteRepo=archetypeRegistryManager.createRepository(request.getArchetypeRepository(), request.getArchetypeArtifactId() + "-repo"); repos.add(remoteRepo); } if (!archetypeArtifactManager.exists(request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(), remoteRepo, localRepository, repos)) { throw new UnknownArchetype("The desired archetype does not exist (" + request.getArchetypeGroupId() + ":" + request.getArchetypeArtifactId() + ":" + request.getArchetypeVersion() + ")"); } if (archetypeArtifactManager.isFileSetArchetype(request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(), remoteRepo, localRepository, repos)) { processFileSetArchetype(request, remoteRepo, localRepository, basedir, repos); } else if (archetypeArtifactManager.isOldArchetype(request.getArchetypeGroupId(), request.getArchetypeArtifactId(), request.getArchetypeVersion(), remoteRepo, localRepository, repos)) { processOldArchetype(request, remoteRepo, localRepository, basedir, repos); } else { throw new ArchetypeGenerationFailure("The defined artifact is not an archetype"); } }
if ( !archetypeArtifactManager.exists( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) )
if ( !archetypeArtifactManager.exists( ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest() ) )