本文整理匯總了Java中org.codehaus.plexus.util.StringUtils.replace方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.replace方法的具體用法?Java StringUtils.replace怎麽用?Java StringUtils.replace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.plexus.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.replace方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: normalizePattern
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private static String normalizePattern(String pattern) {
pattern = pattern.trim();
if (pattern.startsWith(SelectorUtils.REGEX_HANDLER_PREFIX)) {
if (File.separatorChar == '\\') {
pattern = StringUtils.replace(pattern, "/", "\\\\");
}
else {
pattern = StringUtils.replace(pattern, "\\\\", "/");
}
}
else {
pattern = pattern.replace(File.separatorChar == '/' ? '\\' : '/', File.separatorChar);
if (pattern.endsWith(File.separator)) {
pattern += "**";
}
}
return pattern;
}
示例2: developerAccessStarteam
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* Create the documentation to provide an developer access with a
* <code>Starteam</code> SCM. For example, generate the following command
* line:
* <p>
* stcmd co -x -nologo -stop -p myusername:[email protected]:1234/projecturl
* -is
* </p>
* <p>
* stcmd ci -x -nologo -stop -p myusername:[email protected]:1234/projecturl
* -f NCI -is
* </p>
*
* @param starteamRepo
*/
private void developerAccessStarteam(StarteamScmProviderRepository starteamRepo) {
paragraph(getI18nString("devaccess.starteam.intro"));
StringBuilder command = new StringBuilder();
// Safety: remove the username/password if present
String fullUrl = StringUtils.replace(starteamRepo.getFullUrl(), starteamRepo.getUser(), "username");
fullUrl = StringUtils.replace(fullUrl, starteamRepo.getPassword(), "password");
command.append("$ stcmd co -x -nologo -stop -p ");
command.append(fullUrl);
command.append(" -is");
command.append(SystemUtils.LINE_SEPARATOR);
command.append("$ stcmd ci -x -nologo -stop -p ");
command.append(fullUrl);
command.append(" -f NCI -is");
verbatimText(command.toString());
}
示例3: quoted
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private static String quoted( Object obj )
{
String arg = obj.toString();
arg = StringUtils.replace( arg, "\\", "\\\\" );
arg = StringUtils.replace( arg, "'", "\\'" );
return "'" + arg + "'";
}
示例4: createClassPath
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* Constructs AspectJ compiler classpath string
*
* @param project the Maven Project
* @param pluginArtifacts the plugin Artifacts
* @param outDirs the outputDirectories
* @return a os spesific classpath string
*/
@SuppressWarnings( "unchecked" )
public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs )
{
String cp = new String();
Set<Artifact> classPathElements = Collections.synchronizedSet( new LinkedHashSet<Artifact>() );
Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
classPathElements.addAll( dependencyArtifacts == null ? Collections.<Artifact>emptySet() : dependencyArtifacts );
classPathElements.addAll( project.getArtifacts() );
classPathElements.addAll( pluginArtifacts == null ? Collections.<Artifact>emptySet() : pluginArtifacts );
for ( Artifact classPathElement : classPathElements )
{
File artifact = classPathElement.getFile();
if ( null != artifact )
{
String type = classPathElement.getType();
if (!type.equals("pom")){
cp += classPathElement.getFile().getAbsolutePath();
cp += File.pathSeparatorChar;
}
}
}
Iterator<String> outIter = outDirs.iterator();
while ( outIter.hasNext() )
{
cp += outIter.next();
cp += File.pathSeparatorChar;
}
if ( cp.endsWith( "" + File.pathSeparatorChar ) )
{
cp = cp.substring( 0, cp.length() - 1 );
}
cp = StringUtils.replace( cp, "//", "/" );
return cp;
}
示例5: executeMkdirCommand
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* @see org.apache.maven.scm.command.mkdir.AbstractMkdirCommand#executeMkdirCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String)
*/
@Override
protected MkdirScmResult executeMkdirCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
boolean createInLocal )
throws ScmException
{
SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
Iterator<File> it = fileSet.getFileList().iterator();
String dirPath = it.next().getPath();
// replacing \ with / for windauze
if ( dirPath != null && Os.isFamily( Os.FAMILY_DOS ) )
{
dirPath = StringUtils.replace( dirPath, "\\", "/" );
}
String url = javaRepo.getUrl() + "/" + dirPath;
if ( createInLocal )
{
url = dirPath;
}
List<SVNURL> svnurls = new ArrayList<SVNURL>( 1 );
try
{
svnurls.add( SVNURL.parseURIEncoded( url ) );
SVNCommitInfo commitInfo =
SvnJavaUtil.mkdir( javaRepo.getClientManager(), svnurls.toArray( new SVNURL[svnurls.size()] ),
message );
ScmResult scmResult = new ScmResult( null, null, null, true );
return new MkdirScmResult( Long.toString( commitInfo.getNewRevision() ), scmResult );
}
catch ( SVNException e )
{
throw new ScmException( e.getMessage(), e );
}
}
示例6: getScmUrl
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public static String getScmUrl( File repositoryRootFile )
throws CommandLineException
{
String repositoryRoot = repositoryRootFile.getAbsolutePath();
// TODO: it'd be great to build this into CommandLineUtils somehow
// TODO: some way without a custom cygwin sys property?
if ( "true".equals( System.getProperty( "cygwin" ) ) )
{
Commandline cl = new Commandline();
cl.setExecutable( "cygpath" );
cl.createArg().setValue( "--unix" );
cl.createArg().setValue( repositoryRoot );
CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, null );
if ( exitValue != 0 )
{
throw new CommandLineException( "Unable to convert cygwin path, exit code = " + exitValue );
}
repositoryRoot = stdout.getOutput().trim();
}
else if ( Os.isFamily( "windows" ) )
{
repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
}
return "scm:javasvn:file://" + repositoryRoot;
}
示例7: getCommandlineInfo
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
String commandLineInfo = super.getCommandlineInfo( commandLine );
commandLineInfo = StringUtils.replace( commandLineInfo, this.keypass, "'*****'" );
commandLineInfo = StringUtils.replace( commandLineInfo, this.newPassword, "'*****'" );
return commandLineInfo;
}
示例8: getCommandlineInfo
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
String commandLineInfo = super.getCommandlineInfo( commandLine );
commandLineInfo = StringUtils.replace( commandLineInfo, this.keypass, "'*****'" );
return commandLineInfo;
}
示例9: getCommandlineInfo
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected String getCommandlineInfo( final Commandline commandLine )
{
String commandLineInfo = super.getCommandlineInfo( commandLine );
commandLineInfo = StringUtils.replace( commandLineInfo, this.storepass, "'*****'" );
return commandLineInfo;
}
示例10: getCommandlineInfo
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
String commandLineInfo = super.getCommandlineInfo( commandLine );
commandLineInfo = StringUtils.replace( commandLineInfo, this.srckeypass, "'*****'" );
commandLineInfo = StringUtils.replace( commandLineInfo, this.destkeypass, "'*****'" );
commandLineInfo = StringUtils.replace( commandLineInfo, this.srcstorepass, "'*****'" );
commandLineInfo = StringUtils.replace( commandLineInfo, this.deststorepass, "'*****'" );
return commandLineInfo;
}
示例11: getCommandlineInfo
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
String commandLineInfo = super.getCommandlineInfo( commandLine );
commandLineInfo = StringUtils.replace( commandLineInfo, this.newPassword, "'*****'" );
return commandLineInfo;
}
示例12: getFileName
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private static String getFileName(File folder, File file) {
String name = StringUtils.replace(file.getAbsolutePath(), folder.getAbsolutePath() + "/", "");
return name;
}
示例13: writePaths
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private final void writePaths( PrintWriter out, Module[] modules, String[] keys )
throws MojoExecutionException
{
if ( modules == null || modules.length == 0 )
{
return;
}
String[] paths = new String[modules.length];
for ( int i = 0; i < modules.length; i++ )
{
Module module = modules[i];
// String key = ArtifactUtils.versionlessKey( module.getGroupId(), module.getArtifactId() );
// Artifact artifact = (Artifact) project.getArtifactMap().get( key );
Artifact artifact = null;
@SuppressWarnings("unchecked") Set<Artifact> allArtifacts = project.getArtifacts();
for ( Artifact art : allArtifacts )
{
if ( art.getGroupId().equals( module.getGroupId() )
&& art.getArtifactId().equals( module.getArtifactId() )
&& StringUtils.equals( module.getClassifier(), art.getClassifier() )
&& StringUtils.equals( module.getType(), module.getType() ) )
{
artifact = art;
break;
}
}
if ( artifact == null )
{
throw new MojoExecutionException( "The artifact " + module.toString()
+ " referenced in aspectj plugin as an aspect library, is not found the project dependencies" );
}
paths[i] = artifact.getFile().getPath();
}
for ( int i = 1; i <= paths.length; i++ )
{
out.println( "org.eclipse.ajdt.ui.aspectPath.contentKind" + i + "=BINARY" );
}
for ( int i = 1; i <= paths.length; i++ )
{
out.println( "org.eclipse.ajdt.ui.aspectPath.entryKind" + i + "=LIBRARY" );
}
for ( int i = 0; i < paths.length; i++ )
{
out.print( "org.eclipse.ajdt.ui.aspectPath" + i + "=" );
String path = paths[i];
path = StringUtils.replace( path, "\\", "/" );
path = StringUtils.replace( path, ":", "\\:" );
out.println( path );
}
}
示例14: developerAccessCVS
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* Create the documentation to provide an developer access with a
* <code>CVS</code> SCM. For example, generate the following command line:
* <p>
* cvs -d :pserver:[email protected]:/home/cvs login
* </p>
* <p>
* cvs -z3 -d :ext:[email protected]:/home/cvs co maven-plugins/dist
* </p>
*
* @param cvsRepo
* @see <a
* href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
*/
// CHECKSTYLE_ON: LineLength
private void developerAccessCVS(CvsScmProviderRepository cvsRepo) {
paragraph(getI18nString("devaccess.cvs.intro"));
// Safety: remove the username if present
String cvsRoot = StringUtils.replace(cvsRepo.getCvsRoot(), cvsRepo.getUser(), "username");
verbatimText("$ cvs -d " + cvsRoot + " login" + SystemUtils.LINE_SEPARATOR + "$ cvs -z3 -d " + cvsRoot
+ " co " + cvsRepo.getModule());
}