本文整理匯總了Java中org.apache.maven.project.MavenProject.getArtifacts方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenProject.getArtifacts方法的具體用法?Java MavenProject.getArtifacts怎麽用?Java MavenProject.getArtifacts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.project.MavenProject
的用法示例。
在下文中一共展示了MavenProject.getArtifacts方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: list
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
Collection<DependencyWrapper> list(boolean longLiving) {
HashSet<DependencyWrapper> lst;
MavenProject mp = project.getOriginalMavenProject();
Set<Artifact> arts = mp.getArtifacts();
switch (type) {
case COMPILE:
case TEST:
case RUNTIME:
lst = create(arts, longLiving, type.artifactScopes());
break;
default:
lst = create(arts, longLiving, (a) -> !a.getArtifactHandler().isAddedToClasspath());
}
//#200927 do not use comparator in treeset, comparator not equivalent to equals/hashcode
ArrayList<DependencyWrapper> l = new ArrayList<>(lst);
Collections.sort(l, new DependenciesComparator());
return l;
}
示例2: MinijarFilter
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
/**
* @param project {@link MavenProject}
* @param log {@link Log}
* @param simpleFilters {@link SimpleFilter}
* @throws IOException in case of errors.
* @since 1.6
*/
public MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters )
throws IOException
{
this.log = log;
Clazzpath cp = new Clazzpath();
ClazzpathUnit artifactUnit =
cp.addClazzpathUnit( new FileInputStream( project.getArtifact().getFile() ), project.toString() );
for ( Artifact dependency : project.getArtifacts() )
{
addDependencyToClasspath( cp, dependency );
}
removable = cp.getClazzes();
removePackages( artifactUnit );
removable.removeAll( artifactUnit.getClazzes() );
removable.removeAll( artifactUnit.getTransitiveDependencies() );
removeSpecificallyIncludedClasses( project, simpleFilters == null ? Collections.<SimpleFilter>emptyList()
: simpleFilters );
}
示例3: usingTestNG
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private boolean usingTestNG(MavenProject prj) {
for (Artifact a : prj.getArtifacts()) {
if ("org.testng".equals(a.getGroupId()) && "testng".equals(a.getArtifactId())) {
return true;
}
}
return false;
}
示例4: getJUnitVersion
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private String getJUnitVersion(MavenProject prj) {
String juVersion = "";
for (Artifact a : prj.getArtifacts()) {
if ("junit".equals(a.getGroupId()) && ("junit".equals(a.getArtifactId()) || "junit-dep".equals(a.getArtifactId()))) { //junit-dep see #214238
String version = a.getVersion();
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("4.8")) >= 0) {
return "JUNIT4"; //NOI18N
}
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("3.8")) >= 0) {
return "JUNIT3"; //NOI18N
}
}
}
return juVersion;
}
示例5: usingJUnit4
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private boolean usingJUnit4(MavenProject prj) { // SUREFIRE-724
for (Artifact a : prj.getArtifacts()) {
if ("junit".equals(a.getGroupId()) && ("junit".equals(a.getArtifactId()) || "junit-dep".equals(a.getArtifactId()))) { //junit-dep see #214238
String version = a.getVersion();
if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("4.8")) >= 0) {
return true;
}
}
}
return false;
}
示例6: removeSpecificallyIncludedClasses
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private void removeSpecificallyIncludedClasses( MavenProject project, List<SimpleFilter> simpleFilters )
throws IOException
{
// remove classes specifically included in filters
Clazzpath checkCp = new Clazzpath();
for ( Artifact dependency : project.getArtifacts() )
{
File jar = dependency.getFile();
for ( SimpleFilter simpleFilter : simpleFilters )
{
if ( simpleFilter.canFilter( jar ) )
{
ClazzpathUnit depClazzpathUnit = addDependencyToClasspath( checkCp, dependency );
if ( depClazzpathUnit != null )
{
Set<Clazz> clazzes = depClazzpathUnit.getClazzes();
Iterator<Clazz> j = removable.iterator();
while ( j.hasNext() )
{
Clazz clazz = j.next();
if ( clazzes.contains( clazz ) //
&& simpleFilter.isSpecificallyIncluded( clazz.getName().replace( '.', '/' ) ) )
{
log.info( clazz.getName() + " not removed because it was specifically included" );
j.remove();
}
}
}
}
}
}
}