/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * {@code -D} portion is configurable as the 'prefix' parameter. * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props) { for (Entry<String,String> e : props.entrySet()) addKeyValuePair(prefix, e.getKey(), e.getValue(), false); return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix * Configures the -D portion of the example. Defaults to -D if null. * @param props * The map of key/value pairs to add * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to resolve variables in properties string. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; properties = Util.replaceMacro(properties, propertiesGeneratingResolver(vr)); for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), entry.getValue().toString(), (propsToMask == null) ? false : propsToMask.contains(entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * <tt>-D</tt> portion is configurable as the 'prefix' parameter. * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props) { for (Entry<String,String> e : props.entrySet()) addKeyValuePair(prefix, e.getKey(), e.getValue(), false); return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * <tt>-D</tt> portion is configurable as the 'prefix' parameter. * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props) { for (Entry<String,String> e : props.entrySet()) addKeyValuePair(prefix, e.getKey(), e.getValue(), false); return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * <tt>-D</tt> portion is configurable as the 'prefix' parameter. * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props) { for (Entry<String,String> e : props.entrySet()) addKeyValuePair(prefix, e.getKey(), e.getValue(), false); return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * <tt>-D</tt> portion is configurable as the 'prefix' parameter. * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props) { for (Entry<String,String> e : props.entrySet()) addKeyValuePair(prefix, e.getKey(), e.getValue(), false); return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." * * <tt>-D</tt> portion is configurable as the 'prefix' parameter. * * @since 1.114 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String, String> props) { for (Entry<String, String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix Configures the -D portion of the example. Defaults to -D if * null. * @param props The map of key/value pairs to add * @param propsToMask Set containing key names to mark as masked in the * argument list. Key names that do not exist in the set will be added * unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String, String> props, Set<String> propsToMask) { for (Entry<String, String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix * Configures the -D portion of the example. Defaults to -D if null. * @param props * The map of key/value pairs to add * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix * Configures the -D portion of the example. Defaults to -D if null. * @param props * The map of key/value pairs to add * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix * Configures the -D portion of the example. Defaults to -D if null. * @param props * The map of key/value pairs to add * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." with masking. * * @param prefix * Configures the -D portion of the example. Defaults to -D if null. * @param props * The map of key/value pairs to add * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairs(String prefix, Map<String,String> props, Set<String> propsToMask) { for (Entry<String,String> e : props.entrySet()) { addKeyValuePair(prefix, e.getKey(), e.getValue(), (propsToMask == null) ? false : propsToMask.contains(e.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given * string using {@link Properties}. * * @param prefix The '-D' portion of the example. Defaults to -D if null. * @param properties The persisted form of {@link Properties}. For example, * "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. * @param vr {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if (properties == null) { return this; } for (Entry<Object, Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String) entry.getKey(), Util.replaceMacro(entry.getValue().toString(), vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
private void addArtifactoryIntegrationArgs(ArgumentListBuilder args, String buildInfoPropertiesFile, FilePath ws, EnvVars env) throws IOException, InterruptedException { args.addKeyValuePair("-D", BuildInfoConfigProperties.PROP_PROPS_FILE, buildInfoPropertiesFile, false); if (Boolean.parseBoolean(env.get(BuildInfoConfigProperties.PROP_ARTIFACTORY_RESOLUTION_ENABLED))) { args.addKeyValuePair("-D", BuildInfoConfigProperties.PROP_ARTIFACTORY_RESOLUTION_ENABLED, Boolean.TRUE.toString(), false); } // use the classworlds conf packaged with this plugin and resolve the extractor libs File maven3ExtractorJar = Which.jarFile(Maven3BuildInfoLogger.class); FilePath actualDependencyDirectory = PluginDependencyHelper.getActualDependencyDirectory(maven3ExtractorJar, ws); if (getMavenOpts() == null || !getMavenOpts().contains("-Dm3plugin.lib")) { args.addKeyValuePair("-D", "m3plugin.lib", actualDependencyDirectory.getRemote(), false); } URL resource = getClass().getClassLoader().getResource("org/jfrog/hudson/maven3/classworlds-freestyle.conf"); classworldsConfPath = copyClassWorldsFile(ws, resource).getRemote(); args.addKeyValuePair("-D", "classworlds.conf", classworldsConfPath, false); }
private static void addArgs(ArgumentListBuilder args, EnvVars env, SonarInstallation sonarInstallation) { Map<String, String> props = getSonarProps(sonarInstallation); args.add("end"); // expand macros using itself EnvVars.resolve(props); for (Map.Entry<String, String> e : props.entrySet()) { if (!StringUtils.isEmpty(e.getValue())) { // expand macros using environment variables and hide token boolean hide = e.getKey().contains("sonar.login"); args.addKeyValuePair("/d:", e.getKey(), env.expand(e.getValue()), hide); } } args.addTokenized(sonarInstallation.getAdditionalProperties()); }
private void addArgsTo(ArgumentListBuilder args, SonarInstallation sonarInst, EnvVars env, Map<String, String> props) { args.add("begin"); args.add("/k:" + env.expand(projectKey) + ""); args.add("/n:" + env.expand(projectName) + ""); args.add("/v:" + env.expand(projectVersion) + ""); // expand macros using itself EnvVars.resolve(props); for (Map.Entry<String, String> e : props.entrySet()) { if (!StringUtils.isEmpty(e.getValue())) { // expand macros using environment variables and hide token boolean hide = e.getKey().contains("sonar.login"); args.addKeyValuePair("/d:", e.getKey(), env.expand(e.getValue()), hide); } } args.add(sonarInst.getAdditionalAnalysisPropertiesWindows()); args.addTokenized(sonarInst.getAdditionalProperties()); args.addTokenized(env.expand(additionalArguments)); }