本文整理汇总了Java中org.apache.maven.model.Build.getPlugins方法的典型用法代码示例。如果您正苦于以下问题:Java Build.getPlugins方法的具体用法?Java Build.getPlugins怎么用?Java Build.getPlugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Build
的用法示例。
在下文中一共展示了Build.getPlugins方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSnapshots
import org.apache.maven.model.Build; //导入方法依赖的package包/类
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(MavenProject project,
PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking direct plugin references");
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
Build build = project.getBuild();
if (build != null) {
for (Plugin plugin : build.getPlugins()) {
Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(),
new IsSnapshotDependency(propertyResolver));
if (!snapshots.isEmpty()) {
result.putAll(PluginToCoordinates.INSTANCE.apply(plugin),
Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}
}
}
return result;
}
示例2: customizeModel
import org.apache.maven.model.Build; //导入方法依赖的package包/类
void customizeModel( Model model )
{
BuildSettings settings = configurator.getConfiguration().getBuildSettings();
Build build = model.getBuild() != null ? model.getBuild() : new Build();
List<Dependency> dependencies = model.getDependencies();
List<Extension> extensions = build.getExtensions();
List<Plugin> plugins = build.getPlugins();
if ( settings.isSkipTests() )
dependencies.removeIf( d -> StringUtils.equals( d.getScope(), "test" ) );
dependencies.forEach( d -> d.setVersion( replaceVersion( d.getGroupId(), d.getArtifactId(),
d.getVersion() ) ) );
extensions.forEach( e -> e.setVersion( replaceVersion( e.getGroupId(), e.getArtifactId(), e.getVersion() ) ) );
plugins.forEach( p -> p.setVersion( replaceVersion( p.getGroupId(), p.getArtifactId(), p.getVersion() ) ) );
plugins.stream().filter( p -> p.getGroupId().equals( "org.apache.maven.plugins" )
&& p.getArtifactId().equals( "maven-compiler-plugin" ) ).forEach( p -> configureCompiler( p ) );
}
示例3: convertPlugins
import org.apache.maven.model.Build; //导入方法依赖的package包/类
private static List<MavenPlugin> convertPlugins(Model model) {
List<MavenPlugin> result = new ArrayList<>();
Build build = model.getBuild();
if (build != null) {
List<Plugin> plugins = build.getPlugins();
if (plugins != null) {
result.addAll(plugins.stream().map(MavenModelUtil::convertPlugin).collect(toList()));
}
}
return result;
}
示例4: fromPomModelToClientModel
import org.apache.maven.model.Build; //导入方法依赖的package包/类
org.guvnor.common.services.project.model.Build fromPomModelToClientModel(final Build from) {
if (from != null) {
org.guvnor.common.services.project.model.Build build = new org.guvnor.common.services.project.model.Build();
if (from.getPlugins() != null) {
for (Plugin plugin : from.getPlugins()) {
build.getPlugins().add(fromPomModelToClientModel(plugin));
}
}
return build;
} else {
return null;
}
}
示例5: mirahCompilerPluginExists
import org.apache.maven.model.Build; //导入方法依赖的package包/类
private Plugin mirahCompilerPluginExists(final Build build) {
List<Plugin> plugins = build.getPlugins();
if (plugins != null) {
for (Plugin plugin : plugins) {
if (MIRAH_GROUP_ID.equals(plugin.getGroupId()) &&
MIRAH_ARTIFACT_ID.equals(plugin.getArtifactId())) {
return plugin;
}
}
}
return null;
}
示例6: isAddon
import org.apache.maven.model.Build; //导入方法依赖的package包/类
/**
* Returns <code>true</code> if this model is a single-project addon
*/
public boolean isAddon(Model model)
{
boolean result = false;
Build build = model.getBuild();
if (build != null)
{
PLUGIN_LOOP: for (Plugin plugin : build.getPlugins())
{
if ("maven-jar-plugin".equals(plugin.getArtifactId()))
{
for (PluginExecution execution : plugin.getExecutions())
{
Xpp3Dom config = (Xpp3Dom) execution.getConfiguration();
if (config != null)
{
Xpp3Dom classifierNode = config.getChild("classifier");
if (classifierNode != null
&& MavenAddonDependencyResolver.FORGE_ADDON_CLASSIFIER.equals(classifierNode.getValue()))
{
result = true;
break PLUGIN_LOOP;
}
}
}
}
}
}
return result;
}
示例7: testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList
import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList()
{
Plugin parent = new Plugin();
parent.setArtifactId( "testArtifact" );
parent.setGroupId( "testGroup" );
parent.setVersion( "1.0" );
PluginExecution parentExecution = new PluginExecution();
parentExecution.setId( "testExecution" );
parent.addExecution( parentExecution );
Build parentContainer = new Build();
parentContainer.addPlugin( parent );
Plugin child = new Plugin();
child.setArtifactId( "testArtifact" );
child.setGroupId( "testGroup" );
child.setVersion( "1.0" );
Build childContainer = new Build();
childContainer.addPlugin( child );
ModelUtils.mergePluginLists( childContainer, parentContainer, true );
List plugins = childContainer.getPlugins();
assertEquals( 1, plugins.size() );
Plugin plugin = (Plugin) plugins.get( 0 );
assertEquals( 1, plugin.getExecutions().size() );
}
示例8: injectDefaultValues
import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
{
injectDependencyDefaults( model.getDependencies() );
Build build = model.getBuild();
if ( build != null )
{
for ( Plugin plugin : build.getPlugins() )
{
injectDependencyDefaults( plugin.getDependencies() );
}
}
}
示例9: checkContent
import org.apache.maven.model.Build; //导入方法依赖的package包/类
private void checkContent(Project prj, InstanceContent ic, AccessQueryImpl access, ForeignClassBundlerImpl bundler, RecommendedTemplates templates) {
NbMavenProject nbprj = prj.getLookup().lookup(NbMavenProject.class);
String effPackaging = nbprj.getPackagingType();
boolean needToCheckFelixProjectTypes = true;
if(!nbprj.isMavenProjectLoaded()) {
// issue #262646
// due to unfortunate ProjectManager.findPorjetc calls in awt,
// speed is essential during project init, so lets try to avoid
// maven project loading if we can get the info faster from raw model.
needToCheckFelixProjectTypes = false;
Model model;
try {
model = nbprj.getRawModel();
} catch (ModelBuildingException ex) {
// whatever happend, we can't use the model,
// lets try to follow up with loading the maven project
model = null;
Logger.getLogger(OSGILookupProvider.class.getName()).log(Level.FINE, null, ex);
}
Build build = model != null ? model.getBuild() : null;
List<Plugin> plugins = build != null ? build.getPlugins() : null;
if(plugins != null) {
for (Plugin plugin : plugins) {
if(OSGiConstants.GROUPID_FELIX.equals(plugin.getGroupId()) && OSGiConstants.ARTIFACTID_BUNDLE_PLUGIN.equals(plugin.getArtifactId())) {
needToCheckFelixProjectTypes = true;
break;
}
}
}
}
if(needToCheckFelixProjectTypes) {
String[] types = PluginPropertyUtils.getPluginPropertyList(prj, OSGiConstants.GROUPID_FELIX, OSGiConstants.ARTIFACTID_BUNDLE_PLUGIN, "supportedProjectTypes", "supportedProjectType", /*"bundle" would not work for GlassFish parent POM*/null);
if (types != null) {
for (String type : types) {
if (effPackaging.equals(type)) {
effPackaging = NbMavenProject.TYPE_OSGI;
}
}
}
}
if (NbMavenProject.TYPE_OSGI.equals(effPackaging)) {
ic.add(access);
ic.add(bundler);
ic.add(templates);
} else {
ic.remove(access);
ic.remove(bundler);
ic.remove(templates);
}
}
示例10: updatePom
import org.apache.maven.model.Build; //导入方法依赖的package包/类
protected PluginPresents updatePom(Model model) {
Build build = model.getBuild();
if (build == null) { //pom without build tag
model.setBuild(new Build());
build = model.getBuild();
}
Boolean defaultCompilerPluginPresent = Boolean.FALSE;
Boolean alternativeCompilerPluginPresent = Boolean.FALSE;
Boolean kiePluginPresent = Boolean.FALSE;
int alternativeCompilerPosition = 0;
int defaultMavenCompilerPosition = 0;
int kieMavenPluginPosition = 0;
if (model.getPackaging().equals(KJAR_EXT)) {
kiePluginPresent = Boolean.TRUE;
}
int i = 0;
for (Plugin plugin : build.getPlugins()) {
// check if is present the default maven compiler
if (plugin.getGroupId().equals(conf.get(ConfigurationKey.MAVEN_PLUGINS)) &&
plugin.getArtifactId().equals(conf.get(ConfigurationKey.MAVEN_COMPILER_PLUGIN))) {
defaultCompilerPluginPresent = Boolean.TRUE;
defaultMavenCompilerPosition = i;
}
//check if is present the alternative maven compiler
if (plugin.getGroupId().equals(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGINS)) &&
plugin.getArtifactId().equals(conf.get(ConfigurationKey.ALTERNATIVE_COMPILER_PLUGIN))) {
alternativeCompilerPluginPresent = Boolean.TRUE;
alternativeCompilerPosition = i;
}
//check if is present the kie maven plugin
if (plugin.getGroupId().equals(conf.get(ConfigurationKey.KIE_MAVEN_PLUGINS)) &&
plugin.getArtifactId().equals(conf.get(ConfigurationKey.KIE_MAVEN_PLUGIN))) {
kiePluginPresent = Boolean.TRUE;
kieMavenPluginPosition = i;
}
i++;
}
Boolean overwritePOM = updatePOMModel(build,
defaultCompilerPluginPresent,
alternativeCompilerPluginPresent,
kiePluginPresent,
defaultMavenCompilerPosition,
alternativeCompilerPosition,
kieMavenPluginPosition);
return new DefaultPluginPresents(defaultCompilerPluginPresent,
alternativeCompilerPluginPresent,
kiePluginPresent,
overwritePOM);
}
示例11: testShouldMergePluginWithDifferentExecutionFromParentWithoutDuplicatingPluginInList
import org.apache.maven.model.Build; //导入方法依赖的package包/类
public void testShouldMergePluginWithDifferentExecutionFromParentWithoutDuplicatingPluginInList()
{
Plugin parent = new Plugin();
parent.setArtifactId( "testArtifact" );
parent.setGroupId( "testGroup" );
parent.setVersion( "1.0" );
PluginExecution parentExecution = new PluginExecution();
parentExecution.setId( "testExecution" );
parent.addExecution( parentExecution );
Build parentContainer = new Build();
parentContainer.addPlugin( parent );
Plugin child = new Plugin();
child.setArtifactId( "testArtifact" );
child.setGroupId( "testGroup" );
child.setVersion( "1.0" );
PluginExecution childExecution = new PluginExecution();
childExecution.setId( "testExecution2" );
child.addExecution( childExecution );
Build childContainer = new Build();
childContainer.addPlugin( child );
ModelUtils.mergePluginLists( childContainer, parentContainer, true );
List plugins = childContainer.getPlugins();
assertEquals( 1, plugins.size() );
Plugin plugin = (Plugin) plugins.get( 0 );
assertEquals( 2, plugin.getExecutions().size() );
}