Java Code Examples for org.codehaus.plexus.util.StringUtils#replaceOnce()
The following examples show how to use
org.codehaus.plexus.util.StringUtils#replaceOnce() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiffFilter.java From diff-check with GNU Lesser General Public License v2.1 | 6 votes |
public DiffFilter(MavenProject project, File gitDir, List<DiffEntryWrapper> entries) { File baseDir = project.getBasedir(); String baseDirPath = baseDir.getAbsolutePath(); @SuppressWarnings("unchecked") List<String> modules = project.getModules(); for (DiffEntryWrapper entry : entries) { if (!entry.getAbsoluteNewPath().startsWith(baseDirPath)) { continue; } String name = StringUtils.replaceOnce(entry.getAbsoluteNewPath(), baseDirPath, ""); if (CollectionUtils.isNotEmpty(modules)) { for (String module : modules) { if (name.startsWith("/" + module)) { name = StringUtils.replaceOnce(name, "/" + module, ""); break; } } } if (!name.startsWith(SOURCE_PATH_PREFIX)) { continue; } name = StringUtils.replaceOnce(name, SOURCE_PATH_PREFIX, ""); classPathDiffEntryMap.put(name, entry); } }
Example 2
Source File: JavaServiceWrapperDaemonGenerator.java From appassembler with MIT License | 5 votes |
private void writeExecutableFiles( File outputDirectory, Daemon daemon, List<String> jswPlatformIncludes ) throws DaemonGeneratorException { for ( String platform : jswPlatformIncludes ) { String execFile = JSW_PLATFORMS_MAP.get( platform + "-exec" ); if ( execFile != null ) { String outputExecFile = execFile; if ( daemon.isUseDaemonIdAsWrapperExePrefixName() ) { outputExecFile = StringUtils.replaceOnce( execFile, "wrapper", daemon.getId() ); } if ( daemon.getExternalDeltaPackDirectory() != null ) { copyExternalFile( new File( daemon.getExternalDeltaPackDirectory(), JSW_BIN_DIR + "/" + execFile ), new File( outputDirectory, JSW_BIN_DIR + "/" + outputExecFile ) ); } else { copyResourceFile( new File( outputDirectory, JSW_BIN_DIR ), JSW_BIN_DIR, execFile, outputExecFile ); } } else { getLogger().warn( "Exec file for " + platform + " not found in map." ); } } }