本文整理汇总了Java中org.apache.maven.model.Extension类的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Extension类属于org.apache.maven.model包,在下文中一共展示了Extension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
private void writeExtension(Extension extension, String tagName, XmlSerializer serializer)
throws java.io.IOException {
serializer.startTag(NAMESPACE, tagName);
flush(serializer);
StringBuffer b = b(serializer);
int start = b.length();
if (extension.getGroupId() != null) {
writeValue(serializer, "groupId", extension.getGroupId(), extension);
}
if (extension.getArtifactId() != null) {
writeValue(serializer, "artifactId", extension.getArtifactId(), extension);
}
if (extension.getVersion() != null) {
writeValue(serializer, "version", extension.getVersion(), extension);
}
serializer.endTag(NAMESPACE, tagName).flush();
logLocation(extension, "", start, b.length());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:LocationAwareMavenXpp3Writer.java
示例2: customizeModel
import org.apache.maven.model.Extension; //导入依赖的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 ) );
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:20,代码来源:XMvnModelValidator.java
示例3: updateExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
/**
* Method updateExtension
*
* @param value
* @param element
* @param counter
* @param xmlTag
*/
protected void updateExtension( Extension value, String xmlTag, Counter counter, Element element )
{
Element root = element;
Counter innerCount = new Counter( counter.getDepth() + 1 );
findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
}
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:17,代码来源:MavenJDOMWriter.java
示例4: mergeExtensionLists
import org.apache.maven.model.Extension; //导入依赖的package包/类
private static void mergeExtensionLists( Build childBuild, Build parentBuild )
{
for ( Extension e : parentBuild.getExtensions() )
{
if ( !childBuild.getExtensions().contains( e ) )
{
childBuild.addExtension( e );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:11,代码来源:DefaultModelInheritanceAssembler.java
示例5: getExtensionArtifacts
import org.apache.maven.model.Extension; //导入依赖的package包/类
public Set<Artifact> getExtensionArtifacts()
{
if ( extensionArtifacts != null )
{
return extensionArtifacts;
}
extensionArtifacts = new HashSet<Artifact>();
List<Extension> extensions = getBuildExtensions();
if ( extensions != null )
{
for ( Iterator<Extension> i = extensions.iterator(); i.hasNext(); )
{
Extension ext = i.next();
String version;
if ( StringUtils.isEmpty( ext.getVersion() ) )
{
version = "RELEASE";
}
else
{
version = ext.getVersion();
}
Artifact artifact = repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
if ( artifact != null )
{
extensionArtifacts.add( artifact );
}
}
}
extensionArtifactMap = null;
return extensionArtifacts;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:36,代码来源:MavenProject.java
示例6: getBuildExtensions
import org.apache.maven.model.Extension; //导入依赖的package包/类
public List<Extension> getBuildExtensions()
{
Build build = getBuild();
if ( ( build == null ) || ( build.getExtensions() == null ) )
{
return Collections.emptyList();
}
else
{
return build.getExtensions();
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:13,代码来源:MavenProject.java
示例7: createExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
private Extension createExtension( String groupId, String artifactId, String version )
{
Extension extension = new Extension();
extension.setGroupId( groupId );
extension.setArtifactId( artifactId );
extension.setVersion( version );
return extension;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:ProjectSorterTest.java
示例8: mergeExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
protected void mergeExtension( Extension target, Extension source, boolean sourceDominant,
Map<Object, Object> context )
{
mergeExtension_GroupId( target, source, sourceDominant, context );
mergeExtension_ArtifactId( target, source, sourceDominant, context );
mergeExtension_Version( target, source, sourceDominant, context );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:8,代码来源:ModelMerger.java
示例9: mergeExtension_GroupId
import org.apache.maven.model.Extension; //导入依赖的package包/类
protected void mergeExtension_GroupId( Extension target, Extension source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getGroupId();
if ( src != null )
{
if ( sourceDominant || target.getGroupId() == null )
{
target.setGroupId( src );
target.setLocation( "groupId", source.getLocation( "groupId" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例10: mergeExtension_ArtifactId
import org.apache.maven.model.Extension; //导入依赖的package包/类
protected void mergeExtension_ArtifactId( Extension target, Extension source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getArtifactId();
if ( src != null )
{
if ( sourceDominant || target.getArtifactId() == null )
{
target.setArtifactId( src );
target.setLocation( "artifactId", source.getLocation( "artifactId" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例11: mergeExtension_Version
import org.apache.maven.model.Extension; //导入依赖的package包/类
protected void mergeExtension_Version( Extension target, Extension source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getVersion();
if ( src != null )
{
if ( sourceDominant || target.getVersion() == null )
{
target.setVersion( src );
target.setLocation( "version", source.getLocation( "version" ) );
}
}
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ModelMerger.java
示例12: replaceBuildExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
@Override
public Extension replaceBuildExtension( Extension extension )
{
return extension;
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:6,代码来源:AbstractModelVisitor.java
示例13: visitBuildExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
@Override
public void visitBuildExtension( Extension extension )
{
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:5,代码来源:AbstractModelVisitor.java
示例14: visitBuildExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
@Override
public void visitBuildExtension( Extension extension )
{
artifacts.add( new DefaultArtifact( extension.getGroupId(), extension.getArtifactId(),
extension.getVersion() ) );
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:7,代码来源:BuildDependencyVisitor.java
示例15: iterateExtension
import org.apache.maven.model.Extension; //导入依赖的package包/类
/**
* Method iterateExtension
*
* @param counter
* @param childTag
* @param parentTag
* @param list
* @param parent
*/
protected void iterateExtension( Counter counter, Element parent, java.util.Collection list,
java.lang.String parentTag, java.lang.String childTag )
{
boolean shouldExist = list != null && list.size() > 0;
Element element = updateElement( counter, parent, parentTag, shouldExist );
if ( shouldExist )
{
Iterator it = list.iterator();
Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
if ( !elIt.hasNext() )
{
elIt = null;
}
Counter innerCount = new Counter( counter.getDepth() + 1 );
while ( it.hasNext() )
{
Extension value = (Extension) it.next();
Element el;
if ( elIt != null && elIt.hasNext() )
{
el = (Element) elIt.next();
if ( !elIt.hasNext() )
{
elIt = null;
}
}
else
{
el = factory.element( childTag, element.getNamespace() );
insertAtPreferredLocation( element, el, innerCount );
}
updateExtension( value, childTag, innerCount, el );
innerCount.increaseCount();
}
if ( elIt != null )
{
while ( elIt.hasNext() )
{
elIt.next();
elIt.remove();
}
}
}
}
开发者ID:immutables,项目名称:maven-shade-plugin,代码行数:54,代码来源:MavenJDOMWriter.java
示例16: check
import org.apache.maven.model.Extension; //导入依赖的package包/类
/**
* Check all plugins and deps.
* @param env Environment
* @throws ValidationException If fails
*/
private void check(final MavenEnvironment env) throws ValidationException {
int errors = 0;
for (final Extension ext : env.project().getBuildExtensions()) {
if (SnapshotsValidator.isSnapshot(ext.getVersion())) {
Logger.warn(
this,
"%s build extension is SNAPSHOT",
ext
);
++errors;
}
}
for (final Plugin plugin : env.project().getBuildPlugins()) {
if (SnapshotsValidator.isSnapshot(plugin.getVersion())) {
Logger.warn(
this,
"%s build plugin is SNAPSHOT",
plugin
);
++errors;
}
}
for (final Dependency dep : env.project().getDependencies()) {
if (SnapshotsValidator.isSnapshot(dep.getVersion())) {
Logger.warn(
this,
"%s dependency is SNAPSHOT",
dep
);
++errors;
}
}
if (errors > 0) {
Logger.warn(
this,
// @checkstyle LineLength (1 line)
"The version of the project is not SNAPSHOT; there shouldn't not be any SNAPSHOT dependencies (%d found)",
errors
);
throw new ValidationException(
"%d dependencies are in SNAPSHOT state",
errors
);
}
}
开发者ID:teamed,项目名称:qulice,代码行数:51,代码来源:SnapshotsValidator.java
示例17: getExtensionKey
import org.apache.maven.model.Extension; //导入依赖的package包/类
protected Object getExtensionKey( Extension object )
{
return object;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:5,代码来源:ModelMerger.java
示例18: getExtensionKey
import org.apache.maven.model.Extension; //导入依赖的package包/类
@Override
protected Object getExtensionKey( Extension object )
{
return object.getGroupId() + ':' + object.getArtifactId();
}
开发者ID:gems-uff,项目名称:oceano,代码行数:6,代码来源:MavenModelMerger.java
示例19: velocityTemplateCorrectlyBuildsPomXml
import org.apache.maven.model.Extension; //导入依赖的package包/类
/**
* DeployMojo can generate correct settings.xml file.
* @throws Exception If something is wrong
*/
@Test
public void velocityTemplateCorrectlyBuildsPomXml() throws Exception {
final Build build = new Build();
final Extension ext = new Extension();
ext.setArtifactId("test-foo");
build.addExtension(ext);
final MavenProject project = new MavenProject();
project.setBuild(build);
final String nspace = "http://maven.apache.org/POM/4.0.0";
MatcherAssert.assertThat(
new VelocityPage(
"com/jcabi/heroku/maven/plugin/pom.xml.vm"
).set("project", project)
.set("timestamp", "332211")
.set(
"deps",
Arrays.asList(
new DefaultArtifact("fooo", "", "", "", "", "", null)
)
)
.toString(),
Matchers.allOf(
XhtmlMatchers.hasXPath(
"//ns1:name[.='332211']",
nspace
),
XhtmlMatchers.hasXPath(
"//ns1:extension[ns1:artifactId='test-foo']",
nspace
),
XhtmlMatchers.hasXPath(
"//ns1:dependency[ns1:groupId='fooo']",
nspace
),
XhtmlMatchers.hasXPath(
"//ns1:configuration[ns1:outputDirectory='${basedir}']",
nspace
)
)
);
}
开发者ID:jcabi,项目名称:jcabi-heroku-maven-plugin,代码行数:46,代码来源:DeployMojoTest.java
示例20: testShouldNotFailWhenProjectReferencesNonExistentProject
import org.apache.maven.model.Extension; //导入依赖的package包/类
public void testShouldNotFailWhenProjectReferencesNonExistentProject()
throws CycleDetectedException, DuplicateProjectException
{
MavenProject project = createProject( "group", "artifact", "1.0" );
Build build = project.getModel().getBuild();
Extension extension = createExtension( "other.group", "other-artifact", "1.0" );
build.addExtension( extension );
new ProjectSorter( Collections.singletonList( project ) );
}
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ProjectSorterTest.java
注:本文中的org.apache.maven.model.Extension类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论