本文整理匯總了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);
}
}
示例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();
}
示例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();
}