private void addJarManifest(String uberJar, MavenProject project, String mainClass) throws IOException { Path path = Paths.get(uberJar); URI uri = URI.create("jar:" + path.toUri()); String user = System.getProperty("user.name"); String manifestContent = IO.load("manifest-template.mf") .replace("$user", user) .replace("$java", Msc.javaVersion()) .replace("$name", project.getName()) .replace("$version", project.getVersion()) .replace("$groupId", project.getGroupId()) .replace("$organization", project.getOrganization() != null ? U.or(project.getOrganization().getName(), "?") : "?") .replace("$url", U.or(project.getUrl(), "?")) .replace("$main", U.safe(mainClass)); try (FileSystem fs = FileSystems.newFileSystem(uri, U.map())) { Path manifest = fs.getPath("META-INF/MANIFEST.MF"); try (Writer writer = Files.newBufferedWriter(manifest, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) { writer.write(manifestContent); } } }
public String getUrl() { return wrapped.getUrl(); }
public String getUrl() { return getMavenProject().getUrl(); }
public String getUrl() { return getMavenProject().getUrl(); } //-- String getUrl()
public String getUrl() { return getDelegate().getUrl(); }
protected File createPackage(final Collection<Resource> resources, final File inputDir) throws MojoExecutionException { try { final URI homepage = project.getUrl() == null ? null : URI.create(project.getUrl()); new PackageBuilder(project.getArtifactId(), project.getDescription(), homepage, log, Optional.fromNullable(pgp)) .createPackage(resources, inputDir, outputFile); return outputFile; } catch (PackagingException e) { throw new MojoExecutionException("Failed to create Debian package", e); } } }
public Project(MavenProject project, String location, File artifactPath) { mavenProject = project; name = project.getName(); groupId = project.getGroupId(); artifactId = project.getArtifactId(); version = project.getVersion(); url = project.getUrl(); classifier = project.getArtifact().getClassifier(); this.artifactPath = artifactPath.getPath(); setLocation(location); }
/** * @param p not null * @return the javadoc link based on the project url i.e. <code>${project.url}/${destDir}</code> where * <code>destDir</code> is configued in the Javadoc plugin configuration (<code>apidocs</code> by default). * @since 2.6 */ private static String getJavadocLink( MavenProject p ) { if ( p.getUrl() == null ) { return null; } String url = cleanUrl( p.getUrl() ); String destDir = "apidocs"; // see JavadocReport#destDir final String pluginId = "org.apache.maven.plugins:maven-javadoc-plugin"; String destDirConfigured = getPluginParameter( p, pluginId, "destDir" ); if ( destDirConfigured != null ) { destDir = destDirConfigured; } return url + "/" + destDir; }
public SiteTop(MavenProject project) { this.caption = getPropertyValue(project, "siteTopCaption", false, false, false); this.link = getPropertyValue(project, "siteTopLink", false, false, false); if (this.link == null || this.link.isEmpty()) { this.link = project.getUrl() + "/index.html"; } else { this.link += "/"; } }
@Override public void invoke(MavenProject mavenProject, Map<String, Object> models, ResultCollector resultCollector) { final String url = mavenProject.getUrl(); if (StringUtils.isEmpty(url)) { resultCollector.addViolation(mavenProject, this, "missing <url/> information", getEmptyLocation(mavenProject)); } }
public void actionPerformed(ActionEvent event) { MavenProject mp = ActionsUtil.readMavenProject(artifact); try { URLDisplayer.getDefault().showURL(new URL(mp.getUrl())); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); } } }
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { MavenProject project; try { project = (MavenProject) helper.evaluate("${project}"); if (project.getUrl() == null) { throw new EnforcerRuleException("The project URL is not defined"); } Matcher matcher = Pattern.compile(regex).matcher(project.getUrl()); if (!matcher.matches()) { throw new EnforcerRuleException( "The project URL " + project.getUrl() + " does not match the required regex: " + regex); } } catch (ExpressionEvaluationException e) { throw new EnforcerRuleException("Unable to lookup an expression " + e.getLocalizedMessage(), e); } catch (PatternSyntaxException e) { throw new EnforcerRuleException("Invalid regex \"" + regex + "\": " + e.getLocalizedMessage(), e); } }
public ViewProjectHomeAction(Artifact artifact) { this.artifact = artifact; putValue(Action.NAME, NbBundle.getMessage(ViewProjectHomeAction.class, "LBL_View_ProjectHome")); MavenProject mp = ActionsUtil.readMavenProject(artifact); //enable only if url persent setEnabled(mp != null && mp.getUrl() != null); }
private Properties createProjectProperties() { final Properties props = new Properties(); final MavenProject prj = this.session.getCurrentProject(); props.put("project.groupId", Strings.emptyIfNull(prj.getGroupId())); //$NON-NLS-1$ props.put("project.artifactId", Strings.emptyIfNull(prj.getArtifactId())); //$NON-NLS-1$ props.put("project.basedir", prj.getBasedir() != null ? prj.getBasedir().getAbsolutePath() : ""); //$NON-NLS-1$ //$NON-NLS-2$ props.put("project.description", Strings.emptyIfNull(prj.getDescription())); //$NON-NLS-1$ props.put("project.id", Strings.emptyIfNull(prj.getId())); //$NON-NLS-1$ props.put("project.inceptionYear", Strings.emptyIfNull(prj.getInceptionYear())); //$NON-NLS-1$ props.put("project.name", Strings.emptyIfNull(prj.getName())); //$NON-NLS-1$ props.put("project.version", Strings.emptyIfNull(prj.getVersion())); //$NON-NLS-1$ props.put("project.url", Strings.emptyIfNull(prj.getUrl())); //$NON-NLS-1$ props.put("project.encoding", Strings.emptyIfNull(this.encoding)); //$NON-NLS-1$ return props; }
private void addJarManifest(String uberJar, MavenProject project, String mainClass) throws IOException { Path path = Paths.get(uberJar); URI uri = URI.create("jar:" + path.toUri()); String user = System.getProperty("user.name"); String manifestContent = IO.load("manifest-template.mf") .replace("$user", user) .replace("$java", Msc.javaVersion()) .replace("$name", project.getName()) .replace("$version", project.getVersion()) .replace("$groupId", project.getGroupId()) .replace("$organization", project.getOrganization() != null ? U.or(project.getOrganization().getName(), "?") : "?") .replace("$url", U.or(project.getUrl(), "?")) .replace("$main", U.safe(mainClass)); try (FileSystem fs = FileSystems.newFileSystem(uri, U.<String, Object>map())) { Path manifest = fs.getPath("META-INF/MANIFEST.MF"); try (Writer writer = Files.newBufferedWriter(manifest, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) { writer.write(manifestContent); } } }
@Override public Map<String, String> getEntries(AbstractVertxMojo mojo, MavenProject project) { Map<String, String> attributes = new HashMap<>(); Model model = project.getModel(); attributes.put(ExtraManifestKeys.PROJECT_ARTIFACT_ID.header(), model.getArtifactId()); attributes.put(ExtraManifestKeys.PROJECT_GROUP_ID.header(), model.getGroupId()); attributes.put(ExtraManifestKeys.PROJECT_VERSION.header(), model.getVersion()); attributes.put(ExtraManifestKeys.PROJECT_NAME.header(), model.getName() == null ? model.getArtifactId() : model.getName()); attributes.put(ExtraManifestKeys.BUILD_TIMESTAMP.header(), manifestTimestampFormat(new Date())); if (project.getUrl() != null) { attributes.put(ExtraManifestKeys.PROJECT_URL.header(), project.getUrl()); } // TODO get the filtered lists. List<Dependency> dependencies = model.getDependencies(); if (dependencies != null && !dependencies.isEmpty()) { String deps = dependencies.stream() .filter(d -> "compile".equals(d.getScope()) || null == d.getScope()) .map(ProjectManifestCustomizer::asCoordinates) .collect(Collectors.joining(" ")); attributes.put(ExtraManifestKeys.PROJECT_DEPS.header(), deps); } return attributes; }
private CompilerData initCompilerData(File jarFile) { Info info = new Info(); if (project != null) { if (autoIncludeDevelopers) { if (project.getDevelopers() != null) { //noinspection unchecked for (Developer dev : project.getDevelopers()) { info.addAuthor(new Info.Author(dev.getName(), dev.getEmail())); } } } if (autoIncludeUrl) { info.setAppURL(project.getUrl()); } } return new CompilerData(comprFormat, kind, installFile.getPath(), null, baseDir.getPath(), jarFile.getPath(), mkdirs, comprLevel, info); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { String siteURL = getRootProjectProperty(project, "siteURL"); siteURL = replaceProperties(siteURL); if (siteURL != null) { project.getModel().getProperties().put("siteURL", siteURL); } updateSiteUrl(replaceProperties(project.getUrl()), replaceProperties(project.getDistributionManagement().getSite().getUrl())); }
/** * For SONAR-3676 */ private static void convertMavenLinksToProperties(Map<String, String> props, MavenProject pom) { setPropertyIfNotAlreadyExists(props, LINKS_HOME_PAGE, pom.getUrl()); Scm scm = pom.getScm(); if (scm == null) { scm = new Scm(); } setPropertyIfNotAlreadyExists(props, LINKS_SOURCES, scm.getUrl()); setPropertyIfNotAlreadyExists(props, LINKS_SOURCES_DEV, scm.getDeveloperConnection()); CiManagement ci = pom.getCiManagement(); if (ci == null) { ci = new CiManagement(); } setPropertyIfNotAlreadyExists(props, LINKS_CI, ci.getUrl()); IssueManagement issues = pom.getIssueManagement(); if (issues == null) { issues = new IssueManagement(); } setPropertyIfNotAlreadyExists(props, LINKS_ISSUE_TRACKER, issues.getUrl()); }
/** * For SONAR-3676 */ private static void convertMavenLinksToProperties(ProjectDefinition definition, MavenProject pom) { setPropertyIfNotAlreadyExists(definition, CoreProperties.LINKS_HOME_PAGE, pom.getUrl()); Scm scm = pom.getScm(); if (scm == null) { scm = new Scm(); } setPropertyIfNotAlreadyExists(definition, CoreProperties.LINKS_SOURCES, scm.getUrl()); setPropertyIfNotAlreadyExists(definition, CoreProperties.LINKS_SOURCES_DEV, scm.getDeveloperConnection()); CiManagement ci = pom.getCiManagement(); if (ci == null) { ci = new CiManagement(); } setPropertyIfNotAlreadyExists(definition, CoreProperties.LINKS_CI, ci.getUrl()); IssueManagement issues = pom.getIssueManagement(); if (issues == null) { issues = new IssueManagement(); } setPropertyIfNotAlreadyExists(definition, CoreProperties.LINKS_ISSUE_TRACKER, issues.getUrl()); }