当前位置: 首页>>代码示例>>Java>>正文


Java VersionChanger类代码示例

本文整理汇总了Java中org.codehaus.mojo.versions.change.VersionChanger的典型用法代码示例。如果您正苦于以下问题:Java VersionChanger类的具体用法?Java VersionChanger怎么用?Java VersionChanger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VersionChanger类属于org.codehaus.mojo.versions.change包,在下文中一共展示了VersionChanger类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.codehaus.mojo.versions.change.VersionChanger; //导入依赖的package包/类
void write(ModelWrapper wrapper, Versions versions, File pom) {
	try {
		VersionChangerFactory versionChangerFactory = new VersionChangerFactory();
		StringBuilder input = PomHelper.readXmlFile(pom);
		ModifiedPomXMLEventReader parsedPom = newModifiedPomXER(input);
		versionChangerFactory.setPom(parsedPom);
		LoggerToMavenLog loggerToMavenLog = new LoggerToMavenLog(PomWriter.log);
		versionChangerFactory.setLog(loggerToMavenLog);
		versionChangerFactory.setModel(wrapper.model);
		log.info("Applying version / parent / plugin / project changes to the pom [{}]", pom);
		VersionChanger changer = versionChangerFactory.newVersionChanger( true,
				true, true, true);
		for (VersionChange versionChange : wrapper.sourceChanges) {
			changer.apply(versionChange);
		}
		log.debug("Applying properties changes to the pom [{}]", pom);
		new PropertyVersionChanger(wrapper, versions, parsedPom, loggerToMavenLog)
				.apply(null);
		try (BufferedWriter bw = new BufferedWriter(new FileWriter(pom))) {
			bw.write(input.toString());
		}
		log.debug("Flushed changes to the pom file [{}]", pom);
	} catch (Exception e) {
		log.error("Exception occurred while trying to apply changes to the POM", e);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:27,代码来源:PomUpdater.java

示例2: update

import org.codehaus.mojo.versions.change.VersionChanger; //导入依赖的package包/类
/**
 * Updates the pom file.
 *
 * @param pom The pom file to update.
 * @throws org.apache.maven.plugin.MojoExecutionException when things go wrong.
 * @throws org.apache.maven.plugin.MojoFailureException when things go wrong.
 * @throws javax.xml.stream.XMLStreamException when things go wrong.
 */
protected synchronized void update( ModifiedPomXMLEventReader pom )
    throws MojoExecutionException, MojoFailureException, XMLStreamException
{
    ContextualLog log = new DelegatingContextualLog( getLog() );
    try
    {
        Model model = PomHelper.getRawModel( pom );
        log.setContext( "Processing " + PomHelper.getGroupId( model ) + ":" + PomHelper.getArtifactId( model ) );

        VersionChangerFactory versionChangerFactory = new VersionChangerFactory();
        versionChangerFactory.setPom( pom );
        versionChangerFactory.setLog( log );
        versionChangerFactory.setModel( model );

        VersionChanger changer = versionChangerFactory.newVersionChanger( processParent, processProject,
                                                                          processDependencies, processPlugins );

        for ( VersionChange versionChange : sourceChanges )
        {
            changer.apply( versionChange );
        }
    }
    catch ( IOException e )
    {
        throw new MojoExecutionException( e.getMessage(), e );
    }
    log.clearContext();
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:37,代码来源:SetMojo.java

示例3: update

import org.codehaus.mojo.versions.change.VersionChanger; //导入依赖的package包/类
/**
 * Updates the pom file.
 *
 * @param pom The pom file to update.
 * @throws org.apache.maven.plugin.MojoExecutionException
 *          when things go wrong.
 * @throws org.apache.maven.plugin.MojoFailureException
 *          when things go wrong.
 * @throws javax.xml.stream.XMLStreamException
 *          when things go wrong.
 */
protected synchronized void update( ModifiedPomXMLEventReader pom )
        throws MojoExecutionException, MojoFailureException, XMLStreamException
{
    ContextualLog log = new DelegatingContextualLog( getLog() );
    try
    {
        Model model = PomHelper.getRawModel( pom );
        log.setContext( "Processing " + PomHelper.getGroupId( model ) + ":" + PomHelper.getArtifactId( model ) );

        VersionChangerFactory versionChangerFactory = new VersionChangerFactory();
        versionChangerFactory.setPom( pom );
        versionChangerFactory.setLog( log );
        versionChangerFactory.setModel( model );

        VersionChanger changer =
                versionChangerFactory.newVersionChanger( processParent, processProject, processDependencies,
                        processPlugins );

        Iterator i = sourceChanges.iterator();
        while ( i.hasNext() )
        {
            VersionChange versionChange = (VersionChange) i.next();
            changer.apply( versionChange );
        }
    }
    catch ( IOException e )
    {
        throw new MojoExecutionException( e.getMessage(), e );
    }
    log.clearContext();
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:43,代码来源:AbstractVersionsSetMojo.java


注:本文中的org.codehaus.mojo.versions.change.VersionChanger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。