Search in sources :

Example 6 with UnknownArchetype

use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.

the class DefaultArchetypeSelectorTest method testArchetypeNotInRequestDefaults.

public void testArchetypeNotInRequestDefaults() throws PrompterException, IOException, UnknownGroup, ArchetypeSelectionFailure, UnknownArchetype, ArchetypeNotDefined {
    ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
    MockControl control = MockControl.createControl(ArchetypeSelectionQueryer.class);
    ArchetypeSelectionQueryer queryer = (ArchetypeSelectionQueryer) control.getMock();
    queryer.selectArchetype(Collections.<String, List<Archetype>>emptyMap(), createDefaultArchetypeDefinition());
    control.setMatcher(createArgumentMatcher());
    Archetype archetype = new Archetype();
    archetype.setArtifactId("set-artifactId");
    archetype.setGroupId("set-groupId");
    archetype.setVersion("set-version");
    control.setReturnValue(archetype);
    control.replay();
    selector.setArchetypeSelectionQueryer(queryer);
    selector.selectArchetype(request, Boolean.TRUE, "");
    control.verify();
    assertEquals("set-groupId", request.getArchetypeGroupId());
    assertEquals("set-artifactId", request.getArchetypeArtifactId());
    assertEquals("set-version", request.getArchetypeVersion());
}
Also used : MockControl(org.easymock.MockControl) Archetype(org.apache.maven.archetype.catalog.Archetype) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) ArchetypeGenerationRequest(org.apache.maven.archetype.ArchetypeGenerationRequest)

Example 7 with UnknownArchetype

use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.

the class DefaultRepositoryCrawler method crawl.

public ArchetypeCatalog crawl(File repository) {
    if (!repository.isDirectory()) {
        getLogger().warn("File is not a directory");
        return null;
    }
    ArchetypeCatalog catalog = new ArchetypeCatalog();
    @SuppressWarnings("unchecked") Iterator<File> jars = FileUtils.listFiles(repository, new String[] { "jar" }, true).iterator();
    while (jars.hasNext()) {
        File jar = jars.next();
        getLogger().info("Scanning " + jar);
        if (archetypeArtifactManager.isFileSetArchetype(jar) || archetypeArtifactManager.isOldArchetype(jar)) {
            try {
                Archetype archetype = new Archetype();
                Model pom = archetypeArtifactManager.getArchetypePom(jar);
                if (archetypeArtifactManager.isFileSetArchetype(jar)) {
                    org.apache.maven.archetype.metadata.ArchetypeDescriptor descriptor = archetypeArtifactManager.getFileSetArchetypeDescriptor(jar);
                    archetype.setDescription(descriptor.getName());
                } else {
                    org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor descriptor = archetypeArtifactManager.getOldArchetypeDescriptor(jar);
                    archetype.setDescription(descriptor.getId());
                }
                if (pom != null) {
                    if (pom.getGroupId() != null) {
                        archetype.setGroupId(pom.getGroupId());
                    } else {
                        archetype.setGroupId(pom.getParent().getGroupId());
                    }
                    archetype.setArtifactId(pom.getArtifactId());
                    if (pom.getVersion() != null) {
                        archetype.setVersion(pom.getVersion());
                    } else {
                        archetype.setVersion(pom.getParent().getVersion());
                    }
                    getLogger().info("\tArchetype " + archetype + " found in pom");
                } else {
                    String version = jar.getParentFile().getName();
                    String artifactId = jar.getParentFile().getParentFile().getName();
                    String groupIdSep = StringUtils.replace(jar.getParentFile().getParentFile().getParentFile().getPath(), repository.getPath(), "");
                    String groupId = groupIdSep.replace(File.separatorChar, '.');
                    groupId = groupId.startsWith(".") ? groupId.substring(1) : groupId;
                    groupId = groupId.endsWith(".") ? groupId.substring(0, groupId.length() - 1) : groupId;
                    archetype.setGroupId(groupId);
                    archetype.setArtifactId(artifactId);
                    archetype.setVersion(version);
                    getLogger().info("\tArchetype " + archetype + " defined by repository path");
                }
                // end if-else
                catalog.addArchetype(archetype);
            } catch (XmlPullParserException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } catch (UnknownArchetype ex) {
                ex.printStackTrace();
            }
        // end try-catch
        }
    // end if
    }
    // end while
    return catalog;
}
Also used : Archetype(org.apache.maven.archetype.catalog.Archetype) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) IOException(java.io.IOException) Model(org.apache.maven.model.Model) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) ArchetypeCatalog(org.apache.maven.archetype.catalog.ArchetypeCatalog) File(java.io.File)

Example 8 with UnknownArchetype

use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.

the class DefaultArchetypeGenerator method getArchetypeFile.

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;
}
Also used : ArrayList(java.util.ArrayList) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository) ArchetypeNotDefined(org.apache.maven.archetype.exception.ArchetypeNotDefined) File(java.io.File)

Example 9 with UnknownArchetype

use of org.apache.maven.archetype.exception.UnknownArchetype in project liferay-ide by liferay.

the class NewMavenPluginProjectProvider method createNewProject.

@Override
public IStatus createNewProject(NewLiferayPluginProjectOp op, IProgressMonitor monitor) throws CoreException {
    ElementList<ProjectName> projectNames = op.getProjectNames();
    IStatus retval = null;
    IMavenConfiguration mavenConfiguration = MavenPlugin.getMavenConfiguration();
    IMavenProjectRegistry mavenProjectRegistry = MavenPlugin.getMavenProjectRegistry();
    IProjectConfigurationManager projectConfigurationManager = MavenPlugin.getProjectConfigurationManager();
    String groupId = op.getGroupId().content();
    String artifactId = op.getProjectName().content();
    String version = op.getArtifactVersion().content();
    String javaPackage = op.getGroupId().content();
    String activeProfilesValue = op.getActiveProfilesValue().content();
    IPortletFramework portletFramework = op.getPortletFramework().content(true);
    String frameworkName = NewLiferayPluginProjectOpMethods.getFrameworkName(op);
    IPath location = PathBridge.create(op.getLocation().content());
    if (location.lastSegment().equals(artifactId)) {
        // use parent dir since maven archetype will generate new dir under this
        // location
        location = location.removeLastSegments(1);
    }
    String archetypeArtifactId = op.getArchetype().content(true);
    Archetype archetype = new Archetype();
    String[] gav = archetypeArtifactId.split(":");
    String archetypeVersion = gav[gav.length - 1];
    archetype.setGroupId(gav[0]);
    archetype.setArtifactId(gav[1]);
    archetype.setVersion(archetypeVersion);
    ArchetypeManager archetypeManager = MavenPluginActivator.getDefault().getArchetypeManager();
    ArtifactRepository remoteArchetypeRepository = archetypeManager.getArchetypeRepository(archetype);
    Properties properties = new Properties();
    try {
        List<?> archProps = archetypeManager.getRequiredProperties(archetype, remoteArchetypeRepository, monitor);
        if (ListUtil.isNotEmpty(archProps)) {
            for (Object prop : archProps) {
                if (prop instanceof RequiredProperty) {
                    RequiredProperty rProp = (RequiredProperty) prop;
                    Value<PluginType> pluginType = op.getPluginType();
                    if (pluginType.content().equals(PluginType.theme)) {
                        String key = rProp.getKey();
                        if (key.equals("themeParent")) {
                            properties.put(key, op.getThemeParent().content(true));
                        } else if (key.equals("themeType")) {
                            properties.put(key, ThemeUtil.getTemplateExtension(op.getThemeFramework().content(true)));
                        }
                    } else {
                        properties.put(rProp.getKey(), rProp.getDefaultValue());
                    }
                }
            }
        }
    } catch (UnknownArchetype e1) {
        LiferayMavenCore.logError("Unable to find archetype required properties", e1);
    }
    ResolverConfiguration resolverConfig = new ResolverConfiguration();
    if (!CoreUtil.isNullOrEmpty(activeProfilesValue)) {
        resolverConfig.setSelectedProfiles(activeProfilesValue);
    }
    ProjectImportConfiguration configuration = new ProjectImportConfiguration(resolverConfig);
    List<IProject> newProjects = projectConfigurationManager.createArchetypeProjects(location, archetype, groupId, artifactId, version, javaPackage, properties, configuration, monitor);
    if (ListUtil.isNotEmpty(newProjects)) {
        op.setImportProjectStatus(true);
        for (IProject project : newProjects) {
            projectNames.insert().setName(project.getName());
        }
    }
    if (ListUtil.isEmpty(newProjects)) {
        retval = LiferayMavenCore.createErrorStatus("New project was not created due to unknown error");
    } else {
        IProject firstProject = newProjects.get(0);
        if (!CoreUtil.isNullOrEmpty(activeProfilesValue)) {
            String[] activeProfiles = activeProfilesValue.split(",");
            // find all profiles that should go in user settings file
            List<NewLiferayProfile> newUserSettingsProfiles = getNewProfilesToSave(activeProfiles, op.getNewLiferayProfiles(), ProfileLocation.userSettings);
            if (ListUtil.isNotEmpty(newUserSettingsProfiles)) {
                String userSettingsFile = mavenConfiguration.getUserSettingsFile();
                String userSettingsPath = null;
                if (CoreUtil.isNullOrEmpty(userSettingsFile)) {
                    userSettingsPath = SettingsXmlConfigurationProcessor.DEFAULT_USER_SETTINGS_FILE.getAbsolutePath();
                } else {
                    userSettingsPath = userSettingsFile;
                }
                try {
                    // backup user's settings.xml file
                    File settingsXmlFile = new File(userSettingsPath);
                    File backupFile = _getBackupFile(settingsXmlFile);
                    FileUtils.copyFile(settingsXmlFile, backupFile);
                    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
                    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
                    Document pomDocument = docBuilder.parse(settingsXmlFile.getCanonicalPath());
                    for (NewLiferayProfile newProfile : newUserSettingsProfiles) {
                        MavenUtil.createNewLiferayProfileNode(pomDocument, newProfile);
                    }
                    TransformerFactory transformerFactory = TransformerFactory.newInstance();
                    Transformer transformer = transformerFactory.newTransformer();
                    DOMSource source = new DOMSource(pomDocument);
                    StreamResult result = new StreamResult(settingsXmlFile);
                    transformer.transform(source, result);
                } catch (Exception e) {
                    LiferayMavenCore.logError("Unable to save new Liferay profile to user settings.xml.", e);
                }
            }
            // find all profiles that should go in the project pom
            List<NewLiferayProfile> newProjectPomProfiles = getNewProfilesToSave(activeProfiles, op.getNewLiferayProfiles(), ProfileLocation.projectPom);
            // only need to set the first project as nested projects should pickup the
            // parent setting
            IMavenProjectFacade newMavenProject = mavenProjectRegistry.getProject(firstProject);
            IFile pomFile = newMavenProject.getPom();
            IDOMModel domModel = null;
            try {
                domModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(pomFile);
                for (NewLiferayProfile newProfile : newProjectPomProfiles) {
                    MavenUtil.createNewLiferayProfileNode(domModel.getDocument(), newProfile);
                }
                domModel.save();
            } catch (IOException ioe) {
                LiferayMavenCore.logError("Unable to save new Liferay profiles to project pom.", ioe);
            } finally {
                if (domModel != null) {
                    domModel.releaseFromEdit();
                }
            }
            for (IProject project : newProjects) {
                try {
                    projectConfigurationManager.updateProjectConfiguration(new MavenUpdateRequest(project, mavenConfiguration.isOffline(), true), monitor);
                } catch (Exception e) {
                    LiferayMavenCore.logError("Unable to update configuration for " + project.getName(), e);
                }
            }
            String pluginVersion = getNewLiferayProfilesPluginVersion(activeProfiles, op.getNewLiferayProfiles(), archetypeVersion);
            String archVersion = MavenUtil.getMajorMinorVersionOnly(archetypeVersion);
            updateDtdVersion(firstProject, pluginVersion, archVersion);
        }
        Value<PluginType> pluginType = op.getPluginType();
        if (pluginType.content().equals(PluginType.portlet)) {
            String portletName = op.getPortletName().content(false);
            retval = portletFramework.postProjectCreated(firstProject, frameworkName, portletName, monitor);
        }
    }
    if (retval == null) {
        retval = Status.OK_STATUS;
    }
    return retval;
}
Also used : ResolverConfiguration(org.eclipse.m2e.core.project.ResolverConfiguration) MavenUpdateRequest(org.eclipse.m2e.core.project.MavenUpdateRequest) IStatus(org.eclipse.core.runtime.IStatus) DOMSource(javax.xml.transform.dom.DOMSource) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Transformer(javax.xml.transform.Transformer) IFile(org.eclipse.core.resources.IFile) ProjectName(com.liferay.ide.project.core.model.ProjectName) Archetype(org.apache.maven.archetype.catalog.Archetype) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) IDOMModel(org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) IProjectConfigurationManager(org.eclipse.m2e.core.project.IProjectConfigurationManager) IMavenProjectRegistry(org.eclipse.m2e.core.project.IMavenProjectRegistry) Properties(java.util.Properties) Document(org.w3c.dom.Document) IMavenConfiguration(org.eclipse.m2e.core.embedder.IMavenConfiguration) RequiredProperty(org.apache.maven.archetype.metadata.RequiredProperty) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) TransformerFactory(javax.xml.transform.TransformerFactory) IPath(org.eclipse.core.runtime.IPath) StreamResult(javax.xml.transform.stream.StreamResult) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) IOException(java.io.IOException) PluginType(com.liferay.ide.project.core.model.PluginType) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) ArchetypeManager(org.eclipse.m2e.core.internal.archetype.ArchetypeManager) IPortletFramework(com.liferay.ide.project.core.IPortletFramework) ProjectImportConfiguration(org.eclipse.m2e.core.project.ProjectImportConfiguration) DocumentBuilder(javax.xml.parsers.DocumentBuilder) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 10 with UnknownArchetype

use of org.apache.maven.archetype.exception.UnknownArchetype in project maven-archetype by apache.

the class DefaultArchetypeGenerationConfigurator method configureArchetype.

public void configureArchetype(ArchetypeGenerationRequest request, Boolean interactiveMode, Properties executionProperties) throws ArchetypeNotDefined, UnknownArchetype, ArchetypeNotConfigured, IOException, PrompterException, ArchetypeGenerationConfigurationFailure {
    ArtifactRepository localRepository = request.getLocalRepository();
    ArtifactRepository archetypeRepository = null;
    List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>();
    Properties properties = new Properties(executionProperties);
    ArchetypeDefinition ad = new ArchetypeDefinition(request);
    if (!ad.isDefined()) {
        if (!interactiveMode.booleanValue()) {
            throw new ArchetypeNotDefined("No archetype was chosen");
        } else {
            throw new ArchetypeNotDefined("The archetype is not defined");
        }
    }
    if (request.getArchetypeRepository() != null) {
        archetypeRepository = createRepository(request.getArchetypeRepository(), ad.getArtifactId() + "-repo");
        repositories.add(archetypeRepository);
    }
    if (request.getRemoteArtifactRepositories() != null) {
        repositories.addAll(request.getRemoteArtifactRepositories());
    }
    if (!archetypeArtifactManager.exists(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest())) {
        throw new UnknownArchetype("The desired archetype does not exist (" + ad.getGroupId() + ":" + ad.getArtifactId() + ":" + ad.getVersion() + ")");
    }
    request.setArchetypeVersion(ad.getVersion());
    ArchetypeConfiguration archetypeConfiguration;
    if (archetypeArtifactManager.isFileSetArchetype(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest())) {
        org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager.getFileSetArchetypeDescriptor(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest());
        archetypeConfiguration = archetypeFactory.createArchetypeConfiguration(archetypeDescriptor, properties);
    } else if (archetypeArtifactManager.isOldArchetype(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest())) {
        org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor archetypeDescriptor = archetypeArtifactManager.getOldArchetypeDescriptor(ad.getGroupId(), ad.getArtifactId(), ad.getVersion(), archetypeRepository, localRepository, repositories, request.getProjectBuildingRequest());
        archetypeConfiguration = archetypeFactory.createArchetypeConfiguration(archetypeDescriptor, properties);
    } else {
        throw new ArchetypeGenerationConfigurationFailure("The defined artifact is not an archetype");
    }
    Context context = new VelocityContext();
    if (interactiveMode.booleanValue()) {
        boolean confirmed = false;
        context.put(Constants.GROUP_ID, ad.getGroupId());
        context.put(Constants.ARTIFACT_ID, ad.getArtifactId());
        context.put(Constants.VERSION, ad.getVersion());
        while (!confirmed) {
            List<String> propertiesRequired = archetypeConfiguration.getRequiredProperties();
            getLogger().debug("Required properties before content sort: " + propertiesRequired);
            Collections.sort(propertiesRequired, new RequiredPropertyComparator(archetypeConfiguration));
            getLogger().debug("Required properties after content sort: " + propertiesRequired);
            if (!archetypeConfiguration.isConfigured()) {
                for (String requiredProperty : propertiesRequired) {
                    if (!archetypeConfiguration.isConfigured(requiredProperty)) {
                        if ("package".equals(requiredProperty)) {
                            // if the asked property is 'package', then
                            // use its default and if not defined,
                            // use the 'groupId' property value.
                            String packageDefault = archetypeConfiguration.getDefaultValue(requiredProperty);
                            packageDefault = (null == packageDefault || "".equals(packageDefault)) ? archetypeConfiguration.getProperty("groupId") : archetypeConfiguration.getDefaultValue(requiredProperty);
                            String value = getTransitiveDefaultValue(packageDefault, archetypeConfiguration, requiredProperty, context);
                            value = archetypeGenerationQueryer.getPropertyValue(requiredProperty, value, null);
                            archetypeConfiguration.setProperty(requiredProperty, value);
                            context.put(Constants.PACKAGE, value);
                        } else {
                            String value = archetypeConfiguration.getDefaultValue(requiredProperty);
                            value = getTransitiveDefaultValue(value, archetypeConfiguration, requiredProperty, context);
                            value = archetypeGenerationQueryer.getPropertyValue(requiredProperty, value, archetypeConfiguration.getPropertyValidationRegex(requiredProperty));
                            archetypeConfiguration.setProperty(requiredProperty, value);
                            context.put(requiredProperty, value);
                        }
                    } else {
                        getLogger().info("Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty(requiredProperty));
                        archetypeConfiguration.setProperty(requiredProperty, archetypeConfiguration.getProperty(requiredProperty));
                    }
                }
            } else {
                for (String requiredProperty : propertiesRequired) {
                    getLogger().info("Using property: " + requiredProperty + " = " + archetypeConfiguration.getProperty(requiredProperty));
                }
            }
            if (!archetypeConfiguration.isConfigured()) {
                getLogger().warn("Archetype is not fully configured");
            } else if (!archetypeGenerationQueryer.confirmConfiguration(archetypeConfiguration)) {
                getLogger().debug("Archetype generation configuration not confirmed");
                archetypeConfiguration.reset();
                restoreCommandLineProperties(archetypeConfiguration, executionProperties);
            } else {
                getLogger().debug("Archetype generation configuration confirmed");
                confirmed = true;
            }
        }
    } else {
        if (!archetypeConfiguration.isConfigured()) {
            for (String requiredProperty : archetypeConfiguration.getRequiredProperties()) {
                if (!archetypeConfiguration.isConfigured(requiredProperty) && (archetypeConfiguration.getDefaultValue(requiredProperty) != null)) {
                    String value = archetypeConfiguration.getDefaultValue(requiredProperty);
                    value = getTransitiveDefaultValue(value, archetypeConfiguration, requiredProperty, context);
                    archetypeConfiguration.setProperty(requiredProperty, value);
                    context.put(requiredProperty, value);
                }
            }
            // in batch mode, we assume the defaults, and if still not configured fail
            if (!archetypeConfiguration.isConfigured()) {
                StringBuffer exceptionMessage = new StringBuffer();
                exceptionMessage.append("Archetype ");
                exceptionMessage.append(request.getArchetypeGroupId());
                exceptionMessage.append(":");
                exceptionMessage.append(request.getArchetypeArtifactId());
                exceptionMessage.append(":");
                exceptionMessage.append(request.getArchetypeVersion());
                exceptionMessage.append(" is not configured");
                List<String> missingProperties = new ArrayList<String>(0);
                for (String requiredProperty : archetypeConfiguration.getRequiredProperties()) {
                    if (!archetypeConfiguration.isConfigured(requiredProperty)) {
                        exceptionMessage.append("\n\tProperty ");
                        exceptionMessage.append(requiredProperty);
                        missingProperties.add(requiredProperty);
                        exceptionMessage.append(" is missing.");
                        getLogger().warn("Property " + requiredProperty + " is missing. Add -D" + requiredProperty + "=someValue");
                    }
                }
                throw new ArchetypeNotConfigured(exceptionMessage.toString(), missingProperties);
            }
        }
    }
    request.setGroupId(archetypeConfiguration.getProperty(Constants.GROUP_ID));
    request.setArtifactId(archetypeConfiguration.getProperty(Constants.ARTIFACT_ID));
    request.setVersion(archetypeConfiguration.getProperty(Constants.VERSION));
    request.setPackage(archetypeConfiguration.getProperty(Constants.PACKAGE));
    properties = archetypeConfiguration.getProperties();
    request.setProperties(properties);
}
Also used : Context(org.apache.velocity.context.Context) VelocityContext(org.apache.velocity.VelocityContext) ArchetypeDefinition(org.apache.maven.archetype.ui.ArchetypeDefinition) ArchetypeConfiguration(org.apache.maven.archetype.ui.ArchetypeConfiguration) VelocityContext(org.apache.velocity.VelocityContext) ArrayList(java.util.ArrayList) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) MavenArtifactRepository(org.apache.maven.artifact.repository.MavenArtifactRepository) Properties(java.util.Properties) ArchetypeGenerationConfigurationFailure(org.apache.maven.archetype.exception.ArchetypeGenerationConfigurationFailure) ArchetypeNotConfigured(org.apache.maven.archetype.exception.ArchetypeNotConfigured) UnknownArchetype(org.apache.maven.archetype.exception.UnknownArchetype) ArchetypeNotDefined(org.apache.maven.archetype.exception.ArchetypeNotDefined)

Aggregations

UnknownArchetype (org.apache.maven.archetype.exception.UnknownArchetype)12 IOException (java.io.IOException)5 Archetype (org.apache.maven.archetype.catalog.Archetype)5 File (java.io.File)4 ZipFile (java.util.zip.ZipFile)4 ArchetypeDefinition (org.apache.maven.archetype.ui.ArchetypeDefinition)3 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)3 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 ArchetypeGenerationRequest (org.apache.maven.archetype.ArchetypeGenerationRequest)2 ArchetypeNotDefined (org.apache.maven.archetype.exception.ArchetypeNotDefined)2 MavenArtifactRepository (org.apache.maven.artifact.repository.MavenArtifactRepository)2 MockControl (org.easymock.MockControl)2 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)1 PluginType (com.liferay.ide.project.core.model.PluginType)1 ProjectName (com.liferay.ide.project.core.model.ProjectName)1 Reader (java.io.Reader)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1