List of usage examples for org.apache.maven.project MavenProject getArtifactId
public String getArtifactId()
From source file:com.blackducksoftware.integration.hub.jenkins.maven.HubMavenReporter.java
License:Open Source License
private BuildArtifact createBuildArtifact(final MavenProject pom) { final BuildArtifact artifact = new BuildArtifact(); artifact.setType("org.apache.maven"); artifact.setGroup(pom.getGroupId()); artifact.setArtifact(pom.getArtifactId()); artifact.setVersion(pom.getVersion()); artifact.setId(pom.getId());// w w w . j a v a 2 s. co m return artifact; }
From source file:com.blackducksoftware.integration.maven.PluginHelper.java
License:Apache License
public String getBDIOFileName(final MavenProject project) { return project.getArtifactId() + Constants.BDIO_FILE_SUFFIX; }
From source file:com.bluexml.side.Integration.m2.ampMojo.AbstractAmpMojo.java
License:Open Source License
/** * Builds the webapp for the specified project with the new packaging task * thingy/*from w w w . jav a 2 s .c o m*/ * <p/> * Classes, libraries and tld files are copied to the * <tt>webappDirectory</tt> during this phase. * * @param project * the maven project * @param webappDirectory * the target directory * @throws MojoExecutionException * if an error occured while packaging the webapp * @throws MojoFailureException * if an unexpected error occured while packaging the webapp * @throws IOException * if an error occured while copying the files */ public void buildAmp(MavenProject project, File webappDirectory) throws MojoExecutionException, MojoFailureException, IOException { AmpStructure cache; if (mUseCache && mCacheFile.exists()) { cache = new AmpStructure(webappStructureSerialier.fromXml(mCacheFile)); } else { cache = new AmpStructure(null); } final long startTime = System.currentTimeMillis(); getLog().info("Assembling AMP [" + project.getArtifactId() + "] in [" + webappDirectory + "]"); getLog().info("!!!!!!!!! Overlay :\n" + dependentAmpExcludes); final OverlayManager overlayManager = new OverlayManager(mOverlays, project, dependentAmpIncludes, dependentAmpExcludes); final List packagingTasks = getPackagingTasks(overlayManager); final AmpPackagingContext context = new DefaultAmpPackagingContext(webappDirectory, cache, overlayManager); final Iterator it = packagingTasks.iterator(); while (it.hasNext()) { AmpPackagingTask ampPackagingTask = (AmpPackagingTask) it.next(); ampPackagingTask.performPackaging(context); } // Post packaging final List postPackagingTasks = getPostPackagingTasks(); final Iterator it2 = postPackagingTasks.iterator(); while (it2.hasNext()) { AmpPostPackagingTask task = (AmpPostPackagingTask) it2.next(); task.performPostPackaging(context); } getLog().info("AMP assembled in[" + (System.currentTimeMillis() - startTime) + " msecs]"); }
From source file:com.ccoe.build.profiler.profile.DiscoveryProfile.java
License:Apache License
private MavenProject getParentProject(final MavenProject project, final String groupId, final String artifactId) { if (project == null) { return null; }//from ww w. j a v a 2 s . c o m if (project.getGroupId().equals(groupId) && project.getArtifactId().equals(artifactId)) { return project; } if (project.getParent() == null) { return null; } return getParentProject(project.getParent(), groupId, artifactId); }
From source file:com.ccoe.build.profiler.profile.ProjectProfile.java
License:Apache License
public ProjectProfile(Context c, MavenProject project, ExecutionEvent event) { super(new Timer(), event, c); this.project = project; this.phaseProfiles = new ArrayList<PhaseProfile>(); this.projectGroupId = project.getGroupId(); this.projectArtifactId = project.getArtifactId(); this.projectVersion = project.getVersion(); if (event != null) { projectName = event.getProject().getName(); projectId = event.getProject().getId(); }/* w w w . j a va 2 s .c o m*/ if (getSession() != null) { p.setName(projectName); p.setPayload(projectId); p.setStartTime(new Date(this.getTimer().getStartTime())); ProcessHelper.praseProjectPayload(projectId, p); getSession().getProjects().put(projectName, p); getSession().setCurrentProject(p); } }
From source file:com.citytechinc.cq.component.maven.util.ComponentMojoUtil.java
License:Apache License
/** * Finds and retrieves the constructed CQ Package archive file for the * project//from w w w .j av a 2 s.c o m * * @param project * @return The archive file found for the project */ protected static File getArchiveFileForProject(MavenProject project) { File buildDirectory = new File(project.getBuild().getDirectory()); String zipFileName = project.getArtifactId() + "-" + project.getVersion() + ".zip"; getLog().debug("Determined ZIP file name to be " + zipFileName); return new File(buildDirectory, zipFileName); }
From source file:com.citytechinc.cq.component.maven.util.ComponentMojoUtil.java
License:Apache License
/** * Create a temporary archive file which will live alongside the constructed * project CQ5 Package archive.// w ww . j av a 2s. co m * * @param project * @return The temporary archive file */ protected static File getTempArchiveFileForProject(MavenProject project) { File buildDirectory = new File(project.getBuild().getDirectory()); String zipFileName = project.getArtifactId() + "-" + project.getVersion() + "-temp.zip"; getLog().debug("Temp archive file name " + zipFileName); return new File(buildDirectory, zipFileName); }
From source file:com.cloudbees.maven.license.CompleterDelegate.java
License:Open Source License
private String toString(MavenProject p) { return p.getGroupId() + ":" + p.getArtifactId() + ":" + p.getVersion(); }
From source file:com.cloudbees.maven.license.ProcessMojo.java
License:Apache License
public void execute() throws MojoExecutionException { if (disableCheck) return;/* w ww.j a v a 2 s. co m*/ GroovyShell shell = createShell(LicenseScript.class); List<LicenseScript> comp = parseScripts(script, shell); if (generateLicenseHtml != null && generateLicenseXml == null) {// we need XML to be able to generate HTML try { generateLicenseXml = File.createTempFile("license", "xml"); generateLicenseXml.deleteOnExit(); } catch (IOException e) { throw new MojoExecutionException("Failed to generate a temporary file", e); } } if (generateLicenseXml != null) comp.add((LicenseScript) shell.parse(getClass().getResourceAsStream("xmlgen.groovy"), "xmlgen.groovy")); if (generateLicenseHtml != null) comp.add((LicenseScript) shell.parse(getClass().getResourceAsStream("htmlgen.groovy"), "htmlgen.groovy")); if (inlineScript != null) comp.add((LicenseScript) shell.parse(inlineScript, "inlineScript")); for (LicenseScript s : comp) { s.project = project; s.mojo = this; s.run(); // setup } List<MavenProject> dependencies = new ArrayList<MavenProject>(); // run against the project itself for (LicenseScript s : comp) { s.runCompleter(new CompleterDelegate(project, project)); } dependencies.add(project); try { Map<Artifact, MavenProject> models = new HashMap<Artifact, MavenProject>(); for (Artifact a : (Set<Artifact>) project.getArtifacts()) { Artifact pom = artifactFactory.createProjectArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion()); MavenProject model = projectBuilder.buildFromRepository(pom, project.getRemoteArtifactRepositories(), localRepository); models.put(a, model); } // filter them out for (LicenseScript s : comp) { s.runFilter(new FilterDelegate(models)); } // filter out optional components for (Iterator<Entry<Artifact, MavenProject>> itr = models.entrySet().iterator(); itr.hasNext();) { Entry<Artifact, MavenProject> e = itr.next(); if (e.getKey().isOptional()) itr.remove(); } for (MavenProject e : models.values()) { // let the completion script intercept and process the licenses for (LicenseScript s : comp) { s.runCompleter(new CompleterDelegate(e, project)); } } dependencies.addAll(models.values()); } catch (ProjectBuildingException e) { throw new MojoExecutionException("Failed to parse into dependencies", e); } if (requireCompleteLicenseInfo) { List<MavenProject> missing = new ArrayList<MavenProject>(); for (MavenProject d : dependencies) { if (d.getLicenses().isEmpty()) missing.add(d); } if (!missing.isEmpty()) { StringBuilder buf = new StringBuilder( "The following dependencies are missing license information:\n"); for (MavenProject p : missing) { buf.append(" " + p.getGroupId() + ':' + p.getArtifactId() + ':' + p.getVersion()); for (p = p.getParent(); p != null; p = p.getParent()) buf.append(" -> " + p.getGroupId() + ':' + p.getArtifactId() + ':' + p.getVersion()); buf.append('\n'); } buf.append( "\nAdd/update your completion script to fill them, or run with -Dlicense.disableCheck to bypass the check."); throw new MojoExecutionException(buf.toString()); } } for (LicenseScript s : comp) { s.runGenerator(new GeneratorDelegate(dependencies)); } if (attach) { if (generateLicenseXml != null) projectHelper.attachArtifact(project, "license.xml", null, generateLicenseXml); if (generateLicenseHtml != null) projectHelper.attachArtifact(project, "license.html", null, generateLicenseHtml); } }
From source file:com.datacoper.maven.util.DCProjectUtil.java
public static String getQualifier(MavenProject project) { String name = getName(project); return project.getArtifactId().replaceAll(name, ""); }