List of usage examples for org.apache.maven.project MavenProject getGroupId
public String getGroupId()
From source file:org.heneveld.maven.license_audit.util.Coords.java
public static Coords of(MavenProject x) { // prefer artifact coords as that will be canonical, but it might not be available, e.g. for root project if (x.getArtifact() != null) return of(x.getArtifact()); return new Coords(x.getGroupId(), x.getArtifactId(), x.getVersion(), x.getVersion(), "", ""); }
From source file:org.heneveld.maven.license_audit.util.ProjectsOverrides.java
public Map<?, ?> getOverridesForProject(MavenProject p) { Map<Object, Object> result = new LinkedHashMap<Object, Object>(); // wildcard can be specified for project and version trumps next result.putAll(getOverridesForProject(p.getGroupId() + ":*" + ":*")); // but that is trumped by wildcard specified for version trumps result.putAll(getOverridesForProject(Coords.of(p).unversioned() + ":*")); // which is trumped by exact version match result.putAll(getOverridesForProject(Coords.of(p).normal())); // (if no wildcards are specified, they aren't treated as overrides, // but they are treated as defaults, for things like license and urls) return result; }
From source file:org.hsc.novelSpider.bundleplugin.BundlePlugin.java
License:Apache License
/** * @param jar/*from w w w.j ava 2s .c o m*/ * @throws IOException */ private void doMavenMetadata(MavenProject currentProject, Jar jar) throws IOException { String path = "META-INF/maven/" + currentProject.getGroupId() + "/" + currentProject.getArtifactId(); File pomFile = new File(currentProject.getBasedir(), "pom.xml"); jar.putResource(path + "/pom.xml", new FileResource(pomFile)); Properties p = new Properties(); p.put("version", currentProject.getVersion()); p.put("groupId", currentProject.getGroupId()); p.put("artifactId", currentProject.getArtifactId()); ByteArrayOutputStream out = new ByteArrayOutputStream(); p.store(out, "Generated by org.hsc.novelSpider.bundleplugin"); jar.putResource(path + "/pom.properties", new EmbeddedResource(out.toByteArray(), System.currentTimeMillis())); }
From source file:org.hsc.novelSpider.bundleplugin.BundlePlugin.java
License:Apache License
protected Properties getDefaultProperties(MavenProject currentProject) { Properties properties = new Properties(); String bsn;//ww w .j a v a 2 s. co m try { bsn = getMaven2OsgiConverter().getBundleSymbolicName(currentProject.getArtifact()); } catch (Exception e) { bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId(); } // Setup defaults properties.put(MAVEN_SYMBOLICNAME, bsn); properties.put(Analyzer.BUNDLE_SYMBOLICNAME, bsn); properties.put(Analyzer.IMPORT_PACKAGE, "*"); properties.put(Analyzer.BUNDLE_VERSION, getMaven2OsgiConverter().getVersion(currentProject.getVersion())); // remove the extraneous Include-Resource and Private-Package entries from generated manifest properties.put(Constants.REMOVEHEADERS, Analyzer.INCLUDE_RESOURCE + ',' + Analyzer.PRIVATE_PACKAGE); header(properties, Analyzer.BUNDLE_DESCRIPTION, currentProject.getDescription()); StringBuffer licenseText = printLicenses(currentProject.getLicenses()); if (licenseText != null) { header(properties, Analyzer.BUNDLE_LICENSE, licenseText); } header(properties, Analyzer.BUNDLE_NAME, currentProject.getName()); if (currentProject.getOrganization() != null) { if (currentProject.getOrganization().getName() != null) { String organizationName = currentProject.getOrganization().getName(); header(properties, Analyzer.BUNDLE_VENDOR, organizationName); properties.put("project.organization.name", organizationName); properties.put("pom.organization.name", organizationName); } if (currentProject.getOrganization().getUrl() != null) { String organizationUrl = currentProject.getOrganization().getUrl(); header(properties, Analyzer.BUNDLE_DOCURL, organizationUrl); properties.put("project.organization.url", organizationUrl); properties.put("pom.organization.url", organizationUrl); } } properties.putAll(currentProject.getProperties()); properties.putAll(currentProject.getModel().getProperties()); if (m_mavenSession != null) { try { // don't pass upper-case session settings to bnd as they end up in the manifest Properties sessionProperties = m_mavenSession.getExecutionProperties(); for (Enumeration e = sessionProperties.propertyNames(); e.hasMoreElements();) { String key = (String) e.nextElement(); if (key.length() > 0 && !Character.isUpperCase(key.charAt(0))) { properties.put(key, sessionProperties.getProperty(key)); } } } catch (Exception e) { getLog().warn("Problem with Maven session properties: " + e.getLocalizedMessage()); } } properties.putAll(getProperties(currentProject.getModel(), "project.build.")); properties.putAll(getProperties(currentProject.getModel(), "pom.")); properties.putAll(getProperties(currentProject.getModel(), "project.")); properties.put("project.baseDir", getBase(currentProject)); properties.put("project.build.directory", getBuildDirectory()); properties.put("project.build.outputdirectory", getOutputDirectory()); properties.put("classifier", classifier == null ? "" : classifier); getLog().info("BlueprintPlugin"); // Add default plugins header(properties, Analyzer.PLUGIN, SpringXMLType.class.getName()); //header( properties, Analyzer.PLUGIN, BlueprintPlugin.class.getName() + "," + SpringXMLType.class.getName() ); return properties; }
From source file:org.hudsonci.maven.eventspy_30.MavenProjectConverter.java
License:Open Source License
public static MavenCoordinatesDTO asCoordinates(final MavenProject mavenProject) { checkNotNull(mavenProject);// www . ja v a 2 s. c om // Assume groupId, artifactId and version are never null. return new MavenCoordinatesDTO().withGroupId(mavenProject.getGroupId()) .withArtifactId(mavenProject.getArtifactId()).withType(nullSafeString(mavenProject.getPackaging())) .withVersion(mavenProject.getVersion()).normalize(); }
From source file:org.hypoport.milk.maven.plugin.UpdateVersionsMojo.java
License:Apache License
/** * {@inheritDoc}/*w w w . j a v a 2s.c o m*/ */ public void execute() throws MojoExecutionException, MojoFailureException { for (MavenProject project : reactorProjects) { versionChanges.add(new VersionChange(project.getGroupId(), project.getArtifactId(), "", newVersion)); } process(); }
From source file:org.itcollege.valge.licenseaudit.model.Project.java
public Project(MavenProject project, List<Scope> scopes) { this.name = project.getName(); this.artifactId = project.getArtifactId(); this.groupId = project.getGroupId(); this.version = project.getVersion(); this.scopes = scopes; }
From source file:org.jacoco.maven.ReportAggregateMojo.java
License:Open Source License
private MavenProject findProjectFromReactor(final Dependency d) { for (final MavenProject p : reactorProjects) { if (p.getGroupId().equals(d.getGroupId()) && p.getArtifactId().equals(d.getArtifactId()) && p.getVersion().equals(d.getVersion())) { return p; }//from w ww . ja va 2 s .c o m } return null; }
From source file:org.jahia.utils.maven.plugin.osgi.ConvertToOSGiMojo.java
License:Open Source License
private boolean checkProjectParent(MavenProject p, String groupId, String artifactId) { MavenProject parent = p.getParent(); if (parent == null) { return false; }//ww w.j a v a2 s.co m if (groupId.equals(parent.getGroupId()) && artifactId.equals(parent.getArtifactId())) { return true; } else { return checkProjectParent(parent, groupId, artifactId); } }
From source file:org.javagems.core.maven.DebianMojo.java
License:Apache License
/** * Copy properties from the maven project to the ant project. * * @param mavenProject// ww w . j av a 2 s . c om * @param antProject */ public void copyProperties(MavenProject mavenProject, Project antProject) { Properties mavenProps = mavenProject.getProperties(); Iterator iter = mavenProps.keySet().iterator(); while (iter.hasNext()) { String key = (String) iter.next(); antProject.setProperty(key, mavenProps.getProperty(key)); } // Set the POM file as the ant.file for the tasks run directly in Maven. antProject.setProperty("ant.file", mavenProject.getFile().getAbsolutePath()); // Add some of the common maven properties getLog().debug("Setting properties with prefix: " + propertyPrefix); antProject.setProperty((propertyPrefix + "project.groupId"), mavenProject.getGroupId()); antProject.setProperty((propertyPrefix + "project.artifactId"), mavenProject.getArtifactId()); antProject.setProperty((propertyPrefix + "project.name"), mavenProject.getName()); if (mavenProject.getDescription() != null) { antProject.setProperty((propertyPrefix + "project.description"), mavenProject.getDescription()); } antProject.setProperty((propertyPrefix + "project.version"), mavenProject.getVersion()); antProject.setProperty((propertyPrefix + "project.packaging"), mavenProject.getPackaging()); antProject.setProperty((propertyPrefix + "project.build.directory"), mavenProject.getBuild().getDirectory()); antProject.setProperty((propertyPrefix + "project.build.outputDirectory"), mavenProject.getBuild().getOutputDirectory()); antProject.setProperty((propertyPrefix + "project.build.testOutputDirectory"), mavenProject.getBuild().getTestOutputDirectory()); antProject.setProperty((propertyPrefix + "project.build.sourceDirectory"), mavenProject.getBuild().getSourceDirectory()); antProject.setProperty((propertyPrefix + "project.build.testSourceDirectory"), mavenProject.getBuild().getTestSourceDirectory()); antProject.setProperty((propertyPrefix + "localRepository"), localRepository.toString()); antProject.setProperty((propertyPrefix + "settings.localRepository"), localRepository.getBasedir()); // Add properties for depenedency artifacts Set depArtifacts = mavenProject.getArtifacts(); for (Iterator it = depArtifacts.iterator(); it.hasNext();) { Artifact artifact = (Artifact) it.next(); String propName = artifact.getDependencyConflictId(); antProject.setProperty(propertyPrefix + propName, artifact.getFile().getPath()); } // Add a property containing the list of versions for the mapper StringBuffer versionsBuffer = new StringBuffer(); for (Iterator it = depArtifacts.iterator(); it.hasNext();) { Artifact artifact = (Artifact) it.next(); versionsBuffer.append(artifact.getVersion() + File.pathSeparator); } antProject.setProperty(versionsPropertyName, versionsBuffer.toString()); }