List of usage examples for org.apache.maven.artifact ArtifactScopeEnum compile
ArtifactScopeEnum compile
To view the source code for org.apache.maven.artifact ArtifactScopeEnum compile.
Click Source Link
From source file:org.maven.ide.querydsl.QueryDslConfiguration.java
License:Open Source License
private void configure() throws CoreException { // determine apt library that should be downloaded based on the // type of annotation processor: //// ww w. j a v a2 s . c om // jdo : com.mysema.query.apt.jdo.JDOAnnotationProcessor // jpa : com.mysema.query.apt.jpa.JPAAnnotationProcessor // hibernate : com.mysema.query.apt.hibernate.HibernateAnnotationProcessor // collections: com.mysema.query.apt.QuerydslAnnotationProcessor Map<String, ArtifactMetadata> MAP_PROCESSORS_TO_ARTIFACTMETADATA = new HashMap<String, ArtifactMetadata>() { { // put(PROCESSOR_COLLECTIONS, new ArtifactMetadata("com.mysema.querydsl", "querydsl-jdo", m_queryDslVersion, "jar", ArtifactScopeEnum.compile, "apt-one-jar")); put(PROCESSOR_HIBERNATE, new ArtifactMetadata("com.mysema.querydsl", "querydsl-jpa", m_queryDslVersion, "jar", ArtifactScopeEnum.compile, "apt-hibernate-one-jar")); put(PROCESSOR_JDO, new ArtifactMetadata("com.mysema.querydsl", "querydsl-jdo", m_queryDslVersion, "jar", ArtifactScopeEnum.compile, "apt-one-jar")); put(PROCESSOR_JPA, new ArtifactMetadata("com.mysema.querydsl", "querydsl-jpa", m_queryDslVersion, "jar", ArtifactScopeEnum.compile, "apt-one-jar")); } }; // aggregate plugin executions (can there be more than one?): List<PluginExecution> executions = m_plugin.getExecutions(); List<ArtifactMetadata> processorArtifacts = new ArrayList<ArtifactMetadata>(); for (PluginExecution pluginExecution : executions) { Xpp3Dom configuration = (Xpp3Dom) pluginExecution.getConfiguration(); if (configuration == null) { String msg = MessageUtils.info(m_plugin, "Plugin execution does not have configuration element."); throw new IllegalStateException(msg); } Xpp3Dom outputDirectoryElement = configuration.getChild("outputDirectory"); if (outputDirectoryElement != null) { m_outputDirectory = outputDirectoryElement.getValue(); } Xpp3Dom processorElement = configuration.getChild("processor"); if (processorElement != null) { m_annotationProcessor = processorElement.getValue(); if (null == m_annotationProcessor) { String msg = MessageUtils.info(m_plugin, "Configuration element does not define processor value."); throw new IllegalStateException(msg); } ArtifactMetadata artifactMetadata = MAP_PROCESSORS_TO_ARTIFACTMETADATA.get(m_annotationProcessor); if (null != artifactMetadata) { processorArtifacts.add(artifactMetadata); } else { // search explicit plugin dependencies ArtifactMetadata processorArtifactMetadata = searchDependencies(m_annotationProcessor); if (null != processorArtifactMetadata) { processorArtifacts.add(processorArtifactMetadata); } else { String msg = MessageUtils.info(m_plugin, "Unable to find artifact metadata for processor '%s'", m_annotationProcessor); log.warn(msg); // Alternative: just add defined dependencies and let us hope everything will work // we can't handle this scenario throw new IllegalStateException(msg); } // finally: add all plugin dependencies processorArtifacts.addAll(pluginDependenciesAsArtifacts()); } } else { String msg = MessageUtils.info(m_plugin, "Configuration element does not define processor."); throw new IllegalStateException(msg); } } m_processorArtifacts = processorArtifacts.toArray(new ArtifactMetadata[0]); }