org.apache.maven.plugin.PluginNotFoundException#org.codehaus.plexus.util.StringUtils源码实例Demo

下面列出了org.apache.maven.plugin.PluginNotFoundException#org.codehaus.plexus.util.StringUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: maven-native   文件: EnvStreamConsumer.java

@Override
public void consumeLine( String line )
{

    if ( line.startsWith( START_PARSING_INDICATOR ) )
    {
        this.startParsing = true;
        return;
    }

    if ( this.startParsing )
    {
        String[] tokens = StringUtils.split( line, "=" );
        if ( tokens.length == 2 )
        {
            envs.put( tokens[0], tokens[1] );
        }
    }
    else
    {
        System.out.println( line );
    }

}
 

private void exposeContainerProps(String containerId)
    throws DockerAccessException {
    String propKey = getExposedPropertyKeyPart();

    if (StringUtils.isNotEmpty(exposeContainerProps) && StringUtils.isNotEmpty(propKey)) {
        Container container = hub.getQueryService().getMandatoryContainer(containerId);

        String prefix = addDot(exposeContainerProps) + addDot(propKey);
        projectProperties.put(prefix + "id", containerId);
        String ip = container.getIPAddress();
        if (StringUtils.isNotEmpty(ip)) {
            projectProperties.put(prefix + "ip", ip);
        }

        Map<String, String> nets = container.getCustomNetworkIpAddresses();
        if (nets != null) {
            for (Map.Entry<String, String> entry : nets.entrySet()) {
                projectProperties.put(prefix + addDot("net") + addDot(entry.getKey()) + "ip", entry.getValue());
            }
        }
    }
}
 
源代码3 项目: helidon-build-tools   文件: StagerMojo.java

@Override
public void unpack(Path archive, Path target, String excludes, String includes) {
    File archiveFile = archive.toFile();
    UnArchiver unArchiver = null;
    try {
        unArchiver = archiverManager.getUnArchiver(archiveFile);
    } catch (NoSuchArchiverException ex) {
        throw new IllegalStateException(ex);
    }
    unArchiver.setSourceFile(archiveFile);
    unArchiver.setDestDirectory(target.toFile());
    if (StringUtils.isNotEmpty(excludes) || StringUtils.isNotEmpty(includes)) {
        IncludeExcludeFileSelector[] selectors = new IncludeExcludeFileSelector[]{
                new IncludeExcludeFileSelector()
        };
        if (StringUtils.isNotEmpty(excludes)) {
            selectors[0].setExcludes(excludes.split(","));
        }
        if (StringUtils.isNotEmpty(includes)) {
            selectors[0].setIncludes(includes.split(","));
        }
        unArchiver.setFileSelectors(selectors);
    }
    unArchiver.extract();
}
 

private void saveAndCompare( String expectedResource )
    throws IOException
{
    StringOutputStream string = new StringOutputStream();
    formattedProperties.save( string );

    StringOutputStream expected = new StringOutputStream();
    InputStream asStream = getClass().getResourceAsStream( expectedResource );
    try
    {
        IOUtil.copy( asStream, expected );
    }
    finally
    {
        IOUtil.close( asStream );
    }

    String unified = StringUtils.unifyLineSeparators( expected.toString() );
    assertEquals( unified, string.toString() );
}
 
源代码5 项目: hermes   文件: MySQLMessageQueueStorage.java

private Map<String, String> getAppProperties(ByteBuf buf) {
	Map<String, String> map = new HashMap<>();
	if (buf != null) {
		HermesPrimitiveCodec codec = new HermesPrimitiveCodec(buf);
		byte firstByte = codec.readByte();
		if (HermesPrimitiveCodec.NULL != firstByte) {
			codec.readerIndexBack(1);
			int length = codec.readInt();
			if (length > 0) {
				for (int i = 0; i < length; i++) {
					String key = codec.readSuffixStringWithPrefix(PropertiesHolder.APP, true);
					if (!StringUtils.isBlank(key)) {
						map.put(key, codec.readString());
					} else {
						codec.skipString();
					}
				}
			}
		}
	}
	return map;
}
 
源代码6 项目: pitest   文件: ScmMojo.java

private String getSCMConnection() throws MojoExecutionException {

    if (this.getProject().getScm() == null) {
      throw new MojoExecutionException("No SCM Connection configured.");
    }

    final String scmConnection = this.getProject().getScm().getConnection();
    if ("connection".equalsIgnoreCase(this.connectionType)
        && StringUtils.isNotEmpty(scmConnection)) {
      return scmConnection;
    }

    final String scmDeveloper = this.getProject().getScm().getDeveloperConnection();
    if ("developerconnection".equalsIgnoreCase(this.connectionType)
        && StringUtils.isNotEmpty(scmDeveloper)) {
      return scmDeveloper;
    }

    throw new MojoExecutionException("SCM Connection is not set.");

  }
 

@Override
protected void addRelatedDocument(POCDMT000040ClinicalDocument clinicalDocument, String oid, String setid,
        String propertycode, XActRelationshipDocument relationType) {
    POCDMT000040RelatedDocument relatedDocument = of.createPOCDMT000040RelatedDocument();

    relatedDocument.setTypeCode(relationType);
    relatedDocument.setParentDocument(of.createPOCDMT000040ParentDocument());
    relatedDocument.getParentDocument().getIds().add(of.createII());
    relatedDocument.getParentDocument().getIds().get(0).setRoot(oid);
    relatedDocument.getParentDocument().setCode(of.createCE());
    fetchAttributes(propertycode, relatedDocument.getParentDocument().getCode());
    clinicalDocument.getRelatedDocuments().add(relatedDocument);

    if ( !StringUtils.isEmpty(setid) ) {
        relatedDocument.getParentDocument().setSetId(of.createII());
        relatedDocument.getParentDocument().getSetId().setRoot(setid);
    }
}
 
源代码8 项目: netbeans   文件: SourceJavadocByHash.java

public static @CheckForNull File[] find(@NonNull URL root, boolean javadoc) {
    String k = root.toString();
    Preferences n = node(javadoc);
    String v = n.get(k, null);
    if (v == null) {
        return null;
    }
    String[] split = StringUtils.split(v, "||");
    List<File> toRet = new ArrayList<File>();
    for (String vv : split) {
        File f = FileUtilities.convertStringToFile(vv);
        if (f.isFile()) {
            toRet.add(f);
        } else {
            //what do we do when one of the possibly more files is gone?
            //in most cases we are dealing with exactly one file, so keep the
            //previous behaviour of removing it.
            n.remove(k);
        }
    }
    return toRet.toArray(new File[0]);
}
 
源代码9 项目: netbeans   文件: ModuleConvertor.java

private List<Token> getApplicableTokens(Map<String, String> moduleProps, String string) {
    String tokens = moduleProps.get(string);
    if (tokens == null) {
        return Arrays.asList(Token.values());
    }
    String[] split = StringUtils.split(tokens, ",");
    List<Token> toRet = new ArrayList<Token>();
    for (String val : split) {
        try {
            toRet.add(Token.valueOf(val.trim()));
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        }
    }
    return toRet;
}
 
源代码10 项目: opoopress   文件: ThemeMojo.java

private void updateThemeConfigurationFile(SiteConfigImpl siteConfig, File themeDir) throws MojoFailureException{
    File config = new File(themeDir, "theme.yml");
    if (!config.exists()) {
        throw new MojoFailureException("Config file '" + config + "' not exists.");
    }

    Locale loc = Locale.getDefault();
    //locale from parameter
    String localeString = locale;
    //locale from site configuration
    if(StringUtils.isBlank(localeString)){
        localeString = siteConfig.get("locale");
    }
    if (StringUtils.isNotEmpty(localeString)) {
        loc = LocaleUtils.toLocale(localeString);
    }

    File localeConfig = new File(themeDir, "theme_" + loc.toString() + ".yml");
    if (localeConfig.exists()) {
        config.renameTo(new File(themeDir, "theme-original.yml"));
        localeConfig.renameTo(config);
    }
}
 
源代码11 项目: dew   文件: MojoExecutor.java

private ArtifactFilter getArtifactFilter( MojoDescriptor mojoDescriptor )
{
    String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
    String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();

    List<String> scopes = new ArrayList<>( 2 );
    if ( StringUtils.isNotEmpty( scopeToCollect ) )
    {
        scopes.add( scopeToCollect );
    }
    if ( StringUtils.isNotEmpty( scopeToResolve ) )
    {
        scopes.add( scopeToResolve );
    }

    if ( scopes.isEmpty() )
    {
        return null;
    }
    else
    {
        return new CumulativeScopeArtifactFilter( scopes );
    }
}
 
源代码12 项目: dew   文件: MojoExecutor.java

private ArtifactFilter getArtifactFilter(MojoDescriptor mojoDescriptor) {
    String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
    String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();

    List<String> scopes = new ArrayList<String>(2);
    if (StringUtils.isNotEmpty(scopeToCollect)) {
        scopes.add(scopeToCollect);
    }
    if (StringUtils.isNotEmpty(scopeToResolve)) {
        scopes.add(scopeToResolve);
    }

    if (scopes.isEmpty()) {
        return null;
    } else {
        return new CumulativeScopeArtifactFilter(scopes);
    }
}
 

/**
 * Validates plugin configuration. Throws exception if configuration is not
 * valid.
 * 
 * @param params
 *            Configuration parameters to validate.
 * @throws MojoFailureException
 *             If configuration is not valid.
 */
protected void validateConfiguration(String... params)
        throws MojoFailureException {
    if (StringUtils.isNotBlank(argLine)
            && MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) {
        throw new MojoFailureException(
                "The argLine doesn't match allowed pattern.");
    }
    if (params != null && params.length > 0) {
        for (String p : params) {
            if (StringUtils.isNotBlank(p)
                    && MAVEN_DISALLOWED_PATTERN.matcher(p).find()) {
                throw new MojoFailureException("The '" + p
                        + "' value doesn't match allowed pattern.");
            }
        }
    }
}
 

/**
 * Get info from scm.
 *
 * @param repository
 * @param fileSet
 * @return
 * @throws ScmException
 * @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
 *       org.apache.maven.scm.provider.svn.SvnScmProvider
 */
protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
    throws ScmException
{
    CommandParameters commandParameters = new CommandParameters();

    // only for Git, we will make a test for shortRevisionLength parameter
    if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
        && this.shortRevisionLength > 0 )
    {
        getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
        if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
        {
            getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
        }
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
    }

    if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
    {
        commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
    }

    return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
                                                                  commandParameters );
}
 
源代码15 项目: helm-maven-plugin   文件: DryRunMojo.java

public void execute() throws MojoExecutionException, MojoFailureException {
	if (skip || skipDryRun) {
		getLog().info("Skip dry run");
		return;
	}
	for (String inputDirectory : getChartDirectories(getChartDirectory())) {
		getLog().info("\n\nPerform dry-run for chart " + inputDirectory + "...");

		callCli(getHelmExecuteablePath()
				+ " " + action
				+ " " + inputDirectory
				+ " --dry-run --generate-name"
				+ (StringUtils.isNotEmpty(getRegistryConfig()) ? " --registry-config=" + getRegistryConfig() : "")
				+ (StringUtils.isNotEmpty(getRepositoryCache()) ? " --repository-cache=" + getRepositoryCache() : "")
				+ (StringUtils.isNotEmpty(getRepositoryConfig()) ? " --repository-config=" + getRepositoryConfig() : ""),
				"There are test failures", true);
	}
}
 
源代码16 项目: hub-detect   文件: VndrParser.java

public DependencyGraph parseVendorConf(final List<String> vendorConfContents) {
    final MutableDependencyGraph graph = new MutableMapDependencyGraph();

    // TODO test against moby
    vendorConfContents.forEach(line -> {
        if (StringUtils.isNotBlank(line) && !line.startsWith("#")) {
            final String[] parts = line.split(" ");

            final ExternalId dependencyExternalId = externalIdFactory.createNameVersionExternalId(Forge.GOLANG, parts[0], parts[1]);
            final Dependency dependency = new Dependency(parts[0], parts[1], dependencyExternalId);
            graph.addChildToRoot(dependency);
        }
    });

    return graph;
}
 

/**
 * 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());
}
 

private ArtifactRepository parseRepository(String repo, ArtifactRepositoryPolicy policy) throws MojoFailureException {
    // if it's a simple url
    String id = null;
    ArtifactRepositoryLayout layout = getLayout("default");
    String url = repo;

    // if it's an extended repo URL of the form id::layout::url
    if (repo.contains("::")) {
        Matcher matcher = ALT_REPO_SYNTAX_PATTERN.matcher(repo);
        if (!matcher.matches()) {
            throw new MojoFailureException(repo, "Invalid syntax for repository: " + repo,
                    "Invalid syntax for repository. Use \"id::layout::url\" or \"URL\".");
        }

        id = matcher.group(1).trim();
        if (!StringUtils.isEmpty(matcher.group(2))) {
            layout = getLayout(matcher.group(2).trim());
        }
        url = matcher.group(3).trim();
    }
    return artifactRepositoryFactory.createArtifactRepository(id, url, layout, policy, policy);
}
 
源代码19 项目: appassembler   文件: AssembleMojo.java

private JvmSettings convertToJvmSettingsWithDefaultHandling( Program program )
{
    JvmSettings jvmSettings = new JvmSettings();

    if ( program.getJvmSettings() != null )
    {
        // Some kind of settings done on per program base so they take
        // precendence.
        jvmSettings = program.getJvmSettings();
    }
    else
    {
        // No settings in the program done so we use the default behaviour
        if ( StringUtils.isNotBlank( this.extraJvmArguments ) )
        {
            jvmSettings.setExtraArguments( parseTokens( this.extraJvmArguments ) );
        }
    }

    return jvmSettings;
}
 

public String getRevision()
    throws MojoExecutionException
{
    try
    {
        return this.getScmRevision();
    }
    catch ( ScmException e )
    {
        if ( !StringUtils.isEmpty( revisionOnScmFailure ) )
        {
            getLog().warn( "Cannot get the revision information from the scm repository, proceeding with "
                + "revision of " + revisionOnScmFailure + " : \n" + e.getLocalizedMessage() );

            return revisionOnScmFailure;
        }

        throw new MojoExecutionException( "Cannot get the revision information from the scm repository : \n"
            + e.getLocalizedMessage(), e );

    }
}
 
源代码21 项目: sonarqube-licensecheck   文件: License.java

/**
 * @deprecated remove with later release
 * @param serializedLicensesString setting string
 * @return a list with licences
 */
@Deprecated
private static List<License> readLegacySeparated(String serializedLicensesString)
{
    List<License> licenses = new ArrayList<>();

    if (StringUtils.isNotEmpty(serializedLicensesString))
    {
        String[] parts = serializedLicensesString.split(";");

        for (String licenseString : parts)
        {
            String[] subParts = licenseString.split("~");
            String name = subParts.length > 0 ? subParts[0] : null;
            String identifier = subParts.length > 1 ? subParts[1] : null;
            String status = subParts.length > 2 ? subParts[2] : null;
            licenses.add(new License(name, identifier, status));
        }
    }

    return licenses;
}
 

protected IProject importRootFolder(IPath rootPath, String triggerFile) throws Exception {
	if (StringUtils.isNotBlank(triggerFile)) {
		IPath triggerFilePath = rootPath.append(triggerFile);
		Preferences preferences = preferenceManager.getPreferences();
		preferences.setTriggerFiles(Arrays.asList(triggerFilePath));
	}
	final List<IPath> roots = Arrays.asList(rootPath);
	IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
		@Override
		public void run(IProgressMonitor monitor) throws CoreException {
			projectsManager.initializeProjects(roots, monitor);
		}
	};
	JavaCore.run(runnable, null, monitor);
	waitForBackgroundJobs();
	String invisibleProjectName = ProjectUtils.getWorkspaceInvisibleProjectName(rootPath);
	return ResourcesPlugin.getWorkspace().getRoot().getProject(invisibleProjectName);
}
 

public void consumeLine( String line )
{

    if ( line.startsWith( START_PARSING_INDICATOR ) )
    {
        this.startParsing = true;
        return;
    }

    if ( this.startParsing )
    {
        String[] tokens = StringUtils.split( line, "=" );
        if ( tokens.length == 2 )
        {
            envs.put( tokens[0], tokens[1] );
        }
    }
    else
    {
        System.out.println( line );
    }

}
 
源代码24 项目: jkube   文件: AnsiLogger.java

/**
 * Update the progress
 */
@Override
public void progressUpdate(String layerId, String status, String progressMessage) {
    if (!batchMode && log.isInfoEnabled() && StringUtils.isNotEmpty(layerId)) {
        if (useAnsi) {
            updateAnsiProgress(layerId, status, progressMessage);
        } else {
            updateNonAnsiProgress();
        }
        flush();
    }
}
 
源代码25 项目: jkube   文件: AnsiLogger.java

private void updateAnsiProgress(String imageId, String status, String progressMessage) {
    Map<String,Integer> imgLineMap = imageLines.get();
    Integer line = imgLineMap.get(imageId);

    int diff = 0;
    if (line == null) {
        line = imgLineMap.size();
        imgLineMap.put(imageId, line);
    } else {
        diff = imgLineMap.size() - line;
    }

    if (diff > 0) {
        print(ansi().cursorUp(diff).eraseLine(Ansi.Erase.ALL).toString());
    }

    // Status with progress bars: (max length = 11, hence pad to 11)
    // Extracting
    // Downloading
    String progress = progressMessage != null ? progressMessage : "";
    String msg =
            ansi()
                    .fg(PROGRESS_ID).a(imageId).reset().a(": ")
                    .fg(PROGRESS_STATUS).a(StringUtils.rightPad(status,11) + " ")
                    .fg(PROGRESS_BAR).a(progress).toString();
    println(msg);

    if (diff > 0) {
        // move cursor back down to bottom
        print(ansi().cursorDown(diff - 1).toString());
    }
}
 
源代码26 项目: jkube   文件: MojoExecutionService.java

private String[] splitGoalSpec(String fullGoal) {
    String[] parts = StringUtils.split(fullGoal, ":");
    if (parts.length != 3) {
        throw new IllegalStateException("Cannot parse " + fullGoal + " as a maven plugin goal. " +
                                       "It must be fully qualified as in <groupId>:<artifactId>:<goal>");
    }
    return new String[]{parts[0] + ":" + parts[1], parts[2]};
}
 
源代码27 项目: galleon   文件: ArtifactItem.java

@Override
public String toString() {
    if (this.classifier == null) {
        return groupId + ":" + artifactId + ":" + StringUtils.defaultString(version, "?") + ":" + type;
    } else {
        return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString(version, "?") + ":"
                + type;
    }
}
 
源代码28 项目: docker-maven-plugin   文件: AnsiLogger.java

/**
 * Update the progress
 */
public void progressUpdate(String layerId, String status, String progressMessage) {
    if (!batchMode && log.isInfoEnabled() && StringUtils.isNotEmpty(layerId)) {
        if (useAnsi) {
            updateAnsiProgress(layerId, status, progressMessage);
        } else {
            updateNonAnsiProgress(layerId);
        }
        flush();
    }
}
 
源代码29 项目: hermes   文件: MySQLMessageQueueStorage.java

private boolean matchesFilter(String topic, MessagePriority dataObj, String filterString) {
	if (StringUtils.isBlank(filterString)) {
		return true;
	}
	ByteBuf byteBuf = Unpooled.wrappedBuffer(dataObj.getAttributes());
	try {
		return m_filter.isMatch(topic, filterString, getAppProperties(byteBuf));
	} catch (Exception e) {
		log.error("Can not find filter for: {}" + filterString);
		return false;
	}
}
 

protected static String removeNonDigitPrefix(String version) {
    if (version != null && !version.isEmpty()) {
        if (!Character.isDigit(version.charAt(0))) {
            Matcher matcher = Pattern.compile("\\d+").matcher(version);
            int i = 0;
            if (matcher.find()) {
                i = matcher.start();
            }
            if (i > 0) {
                version = StringUtils.substring(version, i, version.length());
            }
        }
    }
    return version;
}