List of usage examples for org.apache.maven.project MavenProject getName
public String getName()
From source file:org.apache.james.mailet.AggregateMailetdocsReport.java
License:Apache License
private void logSubproject(MavenProject subproject) { if (getLog().isDebugEnabled()) { getLog().debug("Adding descriptors in " + subproject.getName()); }/* www . j a va 2s.co m*/ }
From source file:org.apache.james.mailet.AggregateMailetdocsReport.java
License:Apache License
private void logNoSubprojects(MavenProject project) { if (getLog().isDebugEnabled()) { getLog().debug("No subprojects for " + project.getName()); }/*from w ww . j a v a2 s.co m*/ }
From source file:org.apache.james.mailet.DefaultDescriptorsExtractor.java
License:Apache License
public DefaultDescriptorsExtractor extract(MavenProject project, Log log) { final JavaClass[] classes = javaClasses(project); final URLClassLoader classLoader = classLoader(project, log); logProjectDependencies(project, log); logDirectories(project, log);/*from www . j a v a 2 s. c o m*/ try { final Class<?> mailetClass = classLoader.loadClass(MAILET_CLASS_NAME); final Class<?> matcherClass = classLoader.loadClass(MATCHER_CLASS_NAME); for (JavaClass nextClass : classes) { addDescriptor(log, classLoader, mailetClass, matcherClass, nextClass); } } catch (ClassNotFoundException e) { log.debug(e); log.info("No mailets in " + project.getName()); } return this; }
From source file:org.apache.james.mailet.MailetdocsReport.java
License:Apache License
private void logProject(MavenProject project) { if (getLog().isDebugEnabled()) { getLog().debug("Building descriptors for " + project.getName()); }/*from ww w. j a v a 2s. c om*/ }
From source file:org.apache.marmotta.maven.plugins.buildinfo.ProjectInfoProvider.java
License:Apache License
public Map<String, String> getInfo(MavenProject project) { Date date = new Date(); Map<String, String> info = new LinkedHashMap<String, String>(); info.put("project.name", project.getName()); info.put("build.module", project.getArtifactId()); info.put("build.version", project.getVersion()); info.put("build.timestamp", DateFormatUtils.format(date, "EEE, dd MMM yyyy HH:mm:ss z")); return info;//from w w w. j a v a 2s. c o m }
From source file:org.apache.tuscany.maven.bundle.plugin.BundlesMetaDataBuildMojo.java
License:Apache License
private void generateManifestJar(ProjectSet jarNames, File root, Log log) throws FileNotFoundException, IOException { for (Map.Entry<String, Set<String>> e : jarNames.nameMap.entrySet()) { MavenProject pom = jarNames.getProject(e.getKey()); Set<String> jars = e.getValue(); String name = trim(e.getKey()); File feature = new File(root, "../" + featuresName + "/" + (useDistributionName ? trim(e.getKey()) : "")); feature.mkdirs();//from w ww . ja v a 2 s . c om String manifestName = name + "-manifest.jar"; File mfJar = new File(feature, manifestName); log.info("Generating manifest jar: " + mfJar.getCanonicalPath()); FileOutputStream fos = new FileOutputStream(mfJar); Manifest mf = new Manifest(); StringBuffer cp = new StringBuffer(); String path = (useDistributionName ? "../../" : "../") + root.getName(); for (String jar : jars) { cp.append(path).append('/').append(jar).append(' '); } if (cp.length() > 0) { cp.deleteCharAt(cp.length() - 1); } Attributes attrs = mf.getMainAttributes(); attrs.putValue("Manifest-Version", "1.0"); attrs.putValue("Implementation-Title", pom.getName()); attrs.putValue("Implementation-Vendor", "The Apache Software Foundation"); attrs.putValue("Implementation-Vendor-Id", "org.apache"); attrs.putValue("Implementation-Version", pom.getVersion()); attrs.putValue("Class-Path", cp.toString()); attrs.putValue("Main-Class", "org.apache.tuscany.sca.node.launcher.NodeMain"); JarOutputStream jos = new JarOutputStream(fos, mf); addFileToJar(jos, "META-INF/LICENSE", getClass().getResource("LICENSE.txt")); addFileToJar(jos, "META-INF/NOTICE", getClass().getResource("NOTICE.txt")); jos.close(); } }
From source file:org.apache.tuscany.maven.bundle.plugin.ModuleBundlesBuildMojo.java
License:Apache License
private void generateManifestJar(ProjectSet jarNames, File root, Log log) throws FileNotFoundException, IOException { for (Map.Entry<String, Set<String>> e : jarNames.nameMap.entrySet()) { MavenProject pom = jarNames.getProject(e.getKey()); Set<String> jars = e.getValue(); File feature = new File(root, "../" + featuresName + "/" + (useDistributionName ? trim(e.getKey()) : "")); feature.mkdirs();//w w w. j av a2 s . co m File mfJar = new File(feature, manifestJarName); log.info("Generating manifest jar: " + mfJar.getCanonicalPath()); FileOutputStream fos = new FileOutputStream(mfJar); Manifest mf = new Manifest(); StringBuffer cp = new StringBuffer(); String path = (useDistributionName ? "../../" : "../") + root.getName(); for (String jar : jars) { cp.append(path).append('/').append(jar).append(' '); } if (cp.length() > 0) { cp.deleteCharAt(cp.length() - 1); } Attributes attrs = mf.getMainAttributes(); attrs.putValue("Manifest-Version", "1.0"); attrs.putValue("Implementation-Title", pom.getName()); attrs.putValue("Implementation-Vendor", "The Apache Software Foundation"); attrs.putValue("Implementation-Vendor-Id", "org.apache"); attrs.putValue("Implementation-Version", pom.getVersion()); attrs.putValue("Class-Path", cp.toString()); attrs.putValue("Main-Class", "org.apache.tuscany.sca.node.launcher.NodeMain"); JarOutputStream jos = new JarOutputStream(fos, mf); addFileToJar(jos, "META-INF/LICENSE", getClass().getResource("LICENSE.txt")); addFileToJar(jos, "META-INF/NOTICE", getClass().getResource("NOTICE.txt")); jos.close(); } }
From source file:org.artificer.integration.java.artifactbuilder.MavenPomArtifactBuilder.java
License:Apache License
@Override public ArtifactBuilder buildArtifacts(BaseArtifactType primaryArtifact, ArtifactContent artifactContent) throws Exception { super.buildArtifacts(primaryArtifact, artifactContent); try {/*from www.java 2 s. co m*/ Model model = new MavenXpp3Reader().read(getContentStream()); MavenProject project = new MavenProject(model); ((ExtendedDocument) primaryArtifact).setExtendedType(JavaModel.TYPE_MAVEN_POM_XML); for (String key : project.getProperties().stringPropertyNames()) { String value = project.getProperties().getProperty(key); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_PROPERTY + key, value); } //set core properties when not specified on the request if (primaryArtifact.getDescription() == null) primaryArtifact.setDescription(project.getDescription()); if (primaryArtifact.getName() == null) primaryArtifact.setName(project.getName()); if (primaryArtifact.getVersion() == null) primaryArtifact.setVersion(project.getVersion()); //set the GAV and packaging info ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_ARTIFACT_ID, model.getArtifactId()); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_GROUP_ID, model.getGroupId()); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_VERSION, model.getVersion()); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_PACKAGING, model.getPackaging()); //set the parent GAV info if (model.getParent() != null) { ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_PARENT_ARTIFACT_ID, model.getParent().getArtifactId()); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_PARENT_GROUP_ID, model.getParent().getGroupId()); ArtificerModelUtils.setCustomProperty(primaryArtifact, JavaModel.PROP_MAVEN_PARENT_VERSION, model.getParent().getVersion()); } return this; } catch (XmlPullParserException e) { throw new IOException(e.getMessage(), e); } }
From source file:org.codehaus.cargo.documentation.ConfluenceProjectStructureDocumentationGenerator.java
License:Apache License
/** * Writes the current MavenProject information. * @param aProject the MavenProject we are currently documenting. * @param treeIndex the current project level. * @return the markup for the given MavenProject. *//*from w ww . j a v a2 s.c o m*/ private String getProjectInfo(MavenProject aProject, int treeIndex) { StringBuilder markup = new StringBuilder(""); markup.append(ASTERISK); markup.append(" "); markup.append(START_COLOR); markup.append(aProject.getFile().getParentFile().getName()); markup.append("/"); markup.append(END_COLOR); String description = aProject.getDescription() != null ? aProject.getDescription() : aProject.getName(); markup.append(": "); markup.append(description); markup.append(LINE_SEPARATOR); markup.append(getModuleTree(aProject, treeIndex)); return markup.toString(); }
From source file:org.codehaus.continuum.builder.maven.m2.DefaultMavenBuilderHelper.java
License:Apache License
public String getProjectName(MavenProject project) { String name = project.getName(); if (StringUtils.isEmpty(name)) { name = project.getGroupId() + ":" + project.getArtifactId(); }/* ww w .j a v a 2 s . c o m*/ return name; }