本文整理汇总了Java中org.apache.maven.scm.manager.ScmManager类的典型用法代码示例。如果您正苦于以下问题:Java ScmManager类的具体用法?Java ScmManager怎么用?Java ScmManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScmManager类属于org.apache.maven.scm.manager包,在下文中一共展示了ScmManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareCopy
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
public void prepareCopy()
throws Exception
{
if (checkoutPath.toFile().exists()){
return;
}
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "svnUrl" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
provider.checkOut( scmManager.makeScmRepository( scmUrl ), //
new ScmFileSet( checkoutPath.toFile() ) );
}
示例2: testInfo
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
@Test
public void testInfo()
throws Exception
{
prepareCopy();
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "scmUrlProject" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.parseURIEncoded( url ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
InfoScmResult result = provider.info( repository, new ScmFileSet( checkoutPath.toFile() ), null );
InfoItem item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
SvnJavaInfoCommand command = new SvnJavaInfoCommand();
ScmLogger logger = new DefaultLog();
command.setLogger(logger);
result = command.executeInfoCommand( repository, new ScmFileSet( checkoutPath.toFile() ), null, true, null );
item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
System.out.println( item.getRevision() );
}
示例3: testInfoLocale
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
public void testInfoLocale()
throws Exception
{
prepareCopy();
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = getBasedir();
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.fromFile( checkoutPath.toFile() ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
InfoScmResult result = provider.info( repository, new ScmFileSet( checkoutPath.toFile() ), null );
InfoItem item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
SvnJavaInfoCommand command = new SvnJavaInfoCommand();
ScmLogger logger = new DefaultLog();
command.setLogger(logger);
result = command.executeInfoCommand( repository, new ScmFileSet( checkoutPath.toFile() ), null, true, null );
item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
System.out.println( item.getRevision() );
}
示例4: resolveBranchOrExpression
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Given the ScmManager for the current execution cycle, and the MavenProject structure, determine if we can
* find a maven-provided manner of resolving the current git branch.
*
* @param scmManager The current maven ScmManager
* @param project The Current maven Project
* @param log A Log to write to
* @return The current git branch name, or <code>${env.GIT_BRACH}</code> if the current git branch could not be resolved.
* @throws ScmException
*/
public static String resolveBranchOrExpression(final ScmManager scmManager, final MavenProject project, final Log log) {
String connectionUrl = resolveUrlOrExpression(project, log);
// If a connectionURL other than the default expression was resolved, try to resolve the branch.
if (!StringUtils.equals(connectionUrl, DEFAULT_URL_EXPRESSION)) {
try {
ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
ScmProvider provider = scmManager.getProviderByRepository(repository);
if (GitScmProviderRepository.PROTOCOL_GIT.equals(provider.getScmType())) {
ScmFileSet fileSet = new ScmFileSet(project.getBasedir());
return GitBranchCommand.getCurrentBranch(new ScmLogDispatcher(), (GitScmProviderRepository) repository.getProviderRepository(), fileSet);
} else {
log.warn("Project SCM defines a non-git SCM provider. Falling back to variable resolution.");
}
} catch (ScmException se) {
log.warn("Unable to resolve Git Branch from Project SCM definition.", se);
}
}
log.debug("Git branch unresolvable from Project SCM definition, defaulting to " + DEFAULT_BRANCH_EXPRESSION);
return DEFAULT_BRANCH_EXPRESSION;
}
示例5: ScmRenderer
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
public ScmRenderer(Log log,
ScmManager scmManager,
Sink sink,
Model model,
I18N i18n,
Locale locale,
String checkoutDirName,
String webAccessUrl,
String anonymousConnection,
String devConnection,
String scmTag) {
super(sink, i18n, locale);
this.log = log;
this.scmManager = scmManager;
this.model = model;
this.checkoutDirectoryName = checkoutDirName;
this.webAccessUrl = webAccessUrl;
this.anonymousConnection = anonymousConnection;
this.devConnection = devConnection;
this.scmTag = scmTag;
}
示例6: testList
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
@Test
public void testList()
throws Exception
{
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "svnUrl" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.parseURIEncoded( url ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "." ) );
ListScmResult listScmResult = provider.list( repository, fileSet, null );
System.out.println( listScmResult.getFiles() );
boolean containsPom = false;
for ( ScmFile scmFile : listScmResult.getFiles() )
{
if ( StringUtils.equals( scmFile.getPath(), "pom.xml" ) )
{
containsPom = true;
}
}
assertTrue( "pom.xml not in list result", containsPom );
}
示例7: getScmManager
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Method to create the ScmManager Instance.
*
* @return ScmManager ScmManager instance
*/
private ScmManager getScmManager() {
ScmManager scmManager = new BasicScmManager();
scmManager.setScmProvider(SVN, new SvnExeScmProvider());
scmManager.setScmProvider(GIT, new GitExeScmProvider());
return scmManager;
}
示例8: makeChanges
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
private void makeChanges(ScmManager scmManager, ScmRepository scmRepository,
List<File> toCheckIn, List<File> toDelete, List<File> toAdd)
throws ScmException {
if (toAdd.size() > 0) {
scmManager.add(scmRepository, new ScmFileSet(workingDir, toAdd), "");
}
if (toDelete.size() > 0) {
scmManager.remove(scmRepository, new ScmFileSet(workingDir, toDelete), "");
}
if (toCheckIn.size() > 0) {
scmManager.checkIn(scmRepository, new ScmFileSet(workingDir, toCheckIn), "");
}
}
示例9: ScmMojo
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
public ScmMojo(final RunPitStrategy executionStrategy,
final ScmManager manager, Predicate<Artifact> filter,
PluginServices plugins, boolean analyseLastCommit, Predicate<MavenProject> nonEmptyProjectCheck) {
super(executionStrategy, filter, plugins, nonEmptyProjectCheck);
this.manager = manager;
this.analyseLastCommit = analyseLastCommit;
}
示例10: MavenScmRevisionNumberFetcher
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Default constructor.
*
* @param scmManager the SCM manager to access to SCM system.
* @param scmConnectionInfo the information to connect to the SCM system.
* @param scmAccessInfo the value for scmAccessInfo.
*/
public MavenScmRevisionNumberFetcher(final ScmManager scmManager,
final ScmConnectionInfo scmConnectionInfo,
final ScmAccessInfo scmAccessInfo)
{
this.scmManager = scmManager;
this.scmConnectionInfo = scmConnectionInfo;
this.scmAccessInfo = scmAccessInfo;
}
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:16,代码来源:MavenScmRevisionNumberFetcher.java
示例11: createRepository
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Creates and configures the SCM repository.
*
* @param scmManager the manager to create the repository dependent on the
* {@link #getConnectionUrl() connection URL}.
* @return the repository implementation to connect to the SCM system.
* @throws ScmException if the repository implementation cannot be created or
* configured. This happens especially if no provider exists for the
* given connection URL.
*/
public ScmRepository createRepository(final ScmManager scmManager)
throws ScmException
{
try
{
final ScmRepository repository =
scmManager.makeScmRepository(connectionUrl);
final ScmProviderRepository providerRepository =
repository.getProviderRepository();
configure(providerRepository);
if (repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost)
{
final ScmProviderRepositoryWithHost providerRepositoryWithHost =
(ScmProviderRepositoryWithHost) repository.getProviderRepository();
configure(providerRepositoryWithHost);
}
if (!StringUtils.isEmpty(tagBase)
&& repository.getProvider().equals("svn"))
{
final SvnScmProviderRepository svnRepository =
(SvnScmProviderRepository) repository.getProviderRepository();
configure(svnRepository);
}
return repository;
}
catch (final Exception e)
{
throw new ScmException("The SCM provider cannot be created.", e);
}
}
示例12: RevisionHelper
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Default constructor.
*
* @param scmManager the manager instance to access the SCM system.
* @param scmConnectionInfo the information to connect to the SCM.
* @param scmAccessInfo the information to query the SCM.
* @param buildDatePattern the date pattern to use to format revision dates.
*/
public RevisionHelper(final ScmManager scmManager,
final ScmConnectionInfo scmConnectionInfo,
final ScmAccessInfo scmAccessInfo, final String buildDatePattern)
{
this.scmManager = scmManager;
this.scmConnectionInfo = scmConnectionInfo;
this.scmAccessInfo = scmAccessInfo;
this.buildDatePattern = buildDatePattern;
}
示例13: setScmManager
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
public void setScmManager( ScmManager scmManager )
{
this.scmManager = scmManager;
}
示例14: checkoutAndCommit
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Check out the artifact.xml file and change the artifact version and
* commit the modified file
*
* @param scmManager
* ScmManager
* @param prop
* properties in release.properties file
* @param checkoutUrl
* url of the repository
* @param repoType
* type of the repository
* @throws FactoryConfigurationError
* @throws IOException
* @throws ScmException
* @throws Exception
*/
private void checkoutAndCommit(ScmManager scmManager, Properties prop, String checkoutUrl, String scmUserName, String scmPassword,
String repoType) throws FactoryConfigurationError, IOException,
ScmException {
String modifiedCheckoutUrl = checkoutUrl;
if (scmUserName != null && scmPassword != null) {
// Building the checkout url to have username and password Eg: scm:svn:https://username:[email protected]/svn/root/module
modifiedCheckoutUrl = checkoutUrl.replace(PROTOCOL_DELIMITER,
PROTOCOL_DELIMITER + scmUserName + COLON +
scmPassword + AT_SYMBOL);
} else if (scmUserName != null && scmPassword == null) {
// Building the checkout url to have username Eg: scm:svn:https://[email protected]/svn/root/module
modifiedCheckoutUrl = checkoutUrl
.replace(PROTOCOL_DELIMITER, PROTOCOL_DELIMITER + scmUserName + AT_SYMBOL);
}
ScmRepository scmRepository = scmManager.makeScmRepository(modifiedCheckoutUrl);
String scmBaseDir = project.getBuild().getDirectory();
// create temp directory for checkout
File targetFile = new File(scmBaseDir, repoType);
targetFile.mkdirs();
ScmFileSet scmFileSet = new ScmFileSet(targetFile, ARTIFACT_XML_REGEX, null);
CheckOutScmResult checkOut = scmManager.checkOut(scmRepository, scmFileSet);
if (checkOut.isSuccess()) {
List<ScmFile> checkedOutFiles = checkOut.getCheckedOutFiles();
for (ScmFile scmFile : checkedOutFiles) {
String scmFilePath = scmFile.getPath();
if (scmFilePath.endsWith(ARTIFACT_XML)) {
File artifactXml = new File(scmBaseDir, scmFilePath);
File projectPath =
new File(scmBaseDir, scmFilePath.replaceAll(ARTIFACT_XML + "$", EMPTY_STRING));
File pomFile = new File(projectPath, POM_XML);
if (!pomFile.exists()) {
log.warn("Skipping as artifact.xml does not belongs to a maven project.");
continue;
}
File synapseConfigs = new File(projectPath + SRC + File.separator + MAIN +
File.separator, SYNAPSE_CONFIG);
try {
if (synapseConfigs.exists()) {
// This is an ESB project
setESBArtifactVersion(prop, repoType, artifactXml);
} else {
// This is a registry project
setRegArtifactVersion(prop, repoType, artifactXml);
}
} catch (Exception e) {
log.error("Error occurred while setting artifact version.", e);
}
}
}
ScmFileSet scmCheckInFileSet =
new ScmFileSet(new File(scmBaseDir), ARTIFACT_XML_REGEX, null);
// commit modified artifact.xml files
scmManager.checkIn(scmRepository, scmCheckInFileSet,
"Committed the modified artifact.xml file.");
}
else {
log.error("Checkout failed: " + checkOut.getCommandOutput());
}
}
示例15: ScmInfo
import org.apache.maven.scm.manager.ScmManager; //导入依赖的package包/类
/**
* Default constructor.
*
* @param scmManager the manager instance to access the SCM system.
* @param connectionType the value for connectionType.
* @param scmDateFormat the value for scmDateFormat.
* @param basedir the value for basedir.
* @param scmCrendentials the authentication for the SCM server.
* @param tagBase the url of tags base directory (used by svn protocol).
* @param queryRangeInDays the range of the query in days to fetch change log
* entries from the SCM.
* @param buildDatePattern the date pattern to use to format the build and
* revision dates.
* @param scmControl the information to control the gathering of SCM meta
* data.
* @param remoteVersion the branch or tag version on the remote server to
* compare against.
* @note This argument list is quite long. The next time we touch this class,
* we should provide a builder.
*/
public ScmInfo(
final ScmManager scmManager,
final String connectionType, // NOPMD
final String scmDateFormat, final File basedir,
final ScmCredentials scmCrendentials, final String tagBase,
final int queryRangeInDays, final String buildDatePattern,
final ScmControl scmControl, final ScmVersion remoteVersion)
{
this.scmManager = scmManager;
this.connectionType = connectionType;
this.scmDateFormat = scmDateFormat;
this.basedir = basedir;
this.scmCrendentials = scmCrendentials;
this.tagBase = tagBase;
this.queryRangeInDays = queryRangeInDays;
this.buildDatePattern = buildDatePattern;
this.scmControl = scmControl;
this.remoteVersion = remoteVersion;
}