List of usage examples for org.apache.maven.project MavenProject getArtifactId
public String getArtifactId()
From source file:com.datacoper.maven.util.DCProjectUtil.java
public static String getModuleNameThroughParent(MavenProject parentProjetct) { final String name = parentProjetct.getArtifactId(); if (!isProjectType(EnumDCProjectType.PARENT, parentProjetct)) { throw new DcRuntimeException("The project {0} not is a project Parent", name); }//from w w w . ja va 2 s . c o m return name.substring(0, name.length() - 7); }
From source file:com.datacoper.maven.util.DCProjectUtil.java
public static String getName(MavenProject project) { String name = project.getArtifactId(); return name.replaceAll("RestAPI", "").replaceAll("RestAPICommon", "").replaceAll("RestAPICommon", "") .replaceAll("EM", "").replaceAll("Common", "").replaceAll("Client", "").replaceAll("-Parent", "") .replaceAll("Web", ""); }
From source file:com.datacoper.maven.util.DCProjectUtil.java
private static boolean isTerminateWith(MavenProject project, String terminate) { String name = project.getArtifactId(); return StringUtil.isTerminateWith(name, terminate); }
From source file:com.edugility.liquibase.maven.AssembleChangeLogMojo.java
License:Open Source License
/** * Returns a {@link Collection} of {@link URL}s representing the * locations of the given {@link Artifact}. * * <p>This method never returns {@code null}.</p> * * <h4>Design Notes</h4>// w ww. ja v a 2 s. c o m * * <p>This method returns a {@link Collection} of {@link URL}s * instead of a single {@link URL} because an {@link Artifact} * representing the {@linkplain #getProject() current project being * built} has two conceptual locations for our purposes: the test * output directory and the build output directory. All other * {@link Artifact}s have exactly one location, <em>viz.</em> {@link * Artifact#getFile()}.</p> * * @param artifact the {@link Artifact} for which {@link URL}s * should be returned; may be {@code null} in which case an * {@linkplain Collection#emptySet() empty <code>Collection</code>} * will be returned * * @return a {@link Collection} of {@link URL}s; never {@code null} * * @exception MalformedURLException if an {@link Artifact}'s * {@linkplain Artifact#getFile() associated <code>File</code>} * could not be {@linkplain URI#toURL() converted into a * <code>URL</code>} * * @see Artifact#getFile() * * @see Build#getTestOutputDirectory() * * @see Build#getOutputDirectory() * * @see File#toURI() * * @see URI#toURL() */ private final Collection<? extends URL> toURLs(final Artifact artifact) throws MalformedURLException { Collection<URL> urls = null; if (artifact != null) { // If the artifact represents the current project itself, then // we need to look in the reactor first (i.e. the // project.build.testOutpuDirectory and the // project.build.outputDirectory areas), since a .jar file for // the project in all likelihood has not yet been created. final String groupId = artifact.getGroupId(); if (groupId != null) { final MavenProject project = this.getProject(); if (project != null && groupId.equals(project.getGroupId())) { final String artifactId = artifact.getArtifactId(); if (artifactId != null && artifactId.equals(project.getArtifactId())) { final Build build = project.getBuild(); if (build != null) { urls = new ArrayList<URL>(); urls.add(new File(build.getTestOutputDirectory()).toURI().toURL()); urls.add(new File(build.getOutputDirectory()).toURI().toURL()); } } } } // If on the other hand the artifact was just a garden-variety // direct or transitive dependency, then just add its file: URL // directly. if (urls == null) { final File file = artifact.getFile(); if (file != null) { final URI uri = file.toURI(); if (uri != null) { urls = Collections.singleton(uri.toURL()); } } } } if (urls == null) { urls = Collections.emptySet(); } return urls; }
From source file:com.ericsson.tools.cpp.compiler.artifacts.ArtifactManager.java
License:Apache License
public Artifact createProjectArtifact(final MavenProject project) { return factory.createProjectArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion()); }
From source file:com.github.ferstl.depgraph.dependency.AggregatingGraphFactory.java
License:Apache License
@Override public String createGraph(MavenProject parent) { this.graphBuilder.graphName(parent.getArtifactId()); if (this.includeParentProjects) { buildModuleTree(parent, this.graphBuilder); }// www . j av a 2s . c o m List<MavenProject> collectedProjects = parent.getCollectedProjects(); for (MavenProject collectedProject : collectedProjects) { // Process project only if its artifact is not filtered if (isPartOfGraph(collectedProject)) { this.mavenGraphAdapter.buildDependencyGraph(collectedProject, this.globalFilter, this.graphBuilder); } } // Add the project as single node if the graph is empty Artifact artifact = parent.getArtifact(); if (this.graphBuilder.isEmpty() && this.globalFilter.include(artifact)) { this.graphBuilder.addNode(new DependencyNode(artifact)); } return this.graphBuilder.toString(); }
From source file:com.github.ferstl.depgraph.dependency.SimpleGraphFactory.java
License:Apache License
@Override public String createGraph(MavenProject project) { this.graphBuilder.graphName(project.getArtifactId()); this.mavenGraphAdapter.buildDependencyGraph(project, this.globalFilter, this.graphBuilder); // Add the project as single node if the graph is empty Artifact artifact = project.getArtifact(); if (this.graphBuilder.isEmpty() && this.globalFilter.include(artifact)) { this.graphBuilder.addNode(new DependencyNode(artifact)); }// www. j a v a2 s.c om return this.graphBuilder.toString(); }
From source file:com.github.ferstl.depgraph.graph.AggregatingGraphFactory.java
License:Apache License
@Override public String createGraph(MavenProject parent) { this.dotBuilder.graphName(parent.getArtifactId()); if (this.includeParentProjects) { buildModuleTree(parent, this.dotBuilder); }/*from w w w .ja v a2 s. c o m*/ @SuppressWarnings("unchecked") List<MavenProject> collectedProjects = parent.getCollectedProjects(); for (MavenProject collectedProject : collectedProjects) { // Process project only if its artifact is not filtered if (isPartOfGraph(collectedProject)) { this.graphBuilderAdapter.buildDependencyGraph(collectedProject, this.globalFilter, this.dotBuilder); } } return this.dotBuilder.toString(); }
From source file:com.github.ferstl.depgraph.graph.SimpleGraphFactory.java
License:Apache License
@Override public String createGraph(MavenProject project) { this.dotBuilder.graphName(project.getArtifactId()); this.graphBuilderAdapter.buildDependencyGraph(project, this.globalFilter, this.dotBuilder); return this.dotBuilder.toString(); }
From source file:com.github.ferstl.maven.pomenforcers.PedanticDependencyManagementLocationEnforcer.java
License:Apache License
private boolean isDependencyManagingProject(MavenProject project) { ArtifactModel projectInfo = new ArtifactModel(project.getGroupId(), project.getArtifactId(), project.getVersion());//from w ww . jav a 2 s. com return this.dependencyManagingPoms.isEmpty() || this.dependencyManagingPoms.contains(projectInfo); }