當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。