Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2010 JFrog Ltd.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.jfrog.hudson.ivy;
 
 import  org.jfrog.build.extractor.listener.ArtifactoryBuildListener;
 
 import java.io.File;
 import java.util.List;
 import java.util.Map;


Author(s):
Tomer Cohen
 
 public class ArtifactoryIvyConfigurator extends AntIvyBuildWrapper implements DeployerOverrider,
         BuildInfoAwareConfigurator {
 
     private ServerDetails details;
     private final Credentials overridingDeployerCredentials;
     private boolean deployArtifacts;
     private boolean deployBuildInfo;
     private boolean includeEnvVars;
     private boolean runChecks;
     private String violationRecipients;
     private boolean includePublishArtifacts;
     private String scopes;
     private boolean licenseAutoDiscovery;
     private boolean disableLicenseAutoDiscovery;
     private boolean discardOldBuilds;
     private final boolean discardBuildArtifacts;
     private final String matrixParams;
     private boolean notM2Compatible;
     private String ivyPattern;
     private String aggregationBuildStatus;
     private String artifactPattern;
     private boolean enableIssueTrackerIntegration;
     private boolean aggregateBuildIssues;
 
     public ArtifactoryIvyConfigurator(ServerDetails detailsCredentials overridingDeployerCredentials,
             boolean deployArtifactsIncludesExcludes artifactDeploymentPatternsboolean deployBuildInfo,
             boolean includeEnvVarsboolean runChecksString violationRecipientsboolean includePublishArtifacts,
             String scopesboolean disableLicenseAutoDiscoveryboolean notM2CompatibleString ivyPattern,
             String artifactPatternboolean discardOldBuildsboolean discardBuildArtifactsString matrixParams,
             boolean enableIssueTrackerIntegrationboolean aggregateBuildIssuesString aggregationBuildStatus) {
         this. = details;
         this. = overridingDeployerCredentials;
         this. = deployArtifacts;
         this. = artifactDeploymentPatterns;
         this. = deployBuildInfo;
        this. = includeEnvVars;
        this. = runChecks;
        this. = violationRecipients;
        this. = includePublishArtifacts;
        this. = scopes;
        this. = disableLicenseAutoDiscovery;
        this. = notM2Compatible;
        this. = ivyPattern;
        this. = aggregationBuildStatus;
        this. = clearApostrophes(artifactPattern);
        this. = discardOldBuilds;
        this. = discardBuildArtifacts;
        this. = matrixParams;
        this. = !disableLicenseAutoDiscovery;
        this. = enableIssueTrackerIntegration;
        this. = aggregateBuildIssues;
    }

    
Clears the extra apostrophes from the start and the end of the string
    private String clearApostrophes(String artifactPattern) {
        return StringUtils.removeEnd(StringUtils.removeStart(artifactPattern"\""), "\"");
    }
    public ServerDetails getDetails() {
        return ;
    }
    public String getMatrixParams() {
        return ;
    }
    public boolean isOverridingDefaultDeployer() {
        return (getOverridingDeployerCredentials() != null);
    }
        return ;
    }
    public boolean isNotM2Compatible() {
        return ;
    }
    public boolean isDiscardBuildArtifacts() {
        return ;
    }
    public void setNotM2Compatible(boolean notM2Compatible) {
        this. = notM2Compatible;
    }
    public boolean isDiscardOldBuilds() {
        return ;
    }
    public void setDiscardOldBuilds(boolean discardOldBuilds) {
        this. = discardOldBuilds;
    }
    public String getArtifactPattern() {
        return clearApostrophes();
    }
    public void setArtifactPattern(String artifactPattern) {
        this. = clearApostrophes(artifactPattern);
    }
    public String getIvyPattern() {
        return ;
    }
    public void setIvyPattern(String ivyPattern) {
        this. = ivyPattern;
    }
    public boolean isM2Compatible() {
        return !;
    }
    public boolean isIncludePublishArtifacts() {
        return ;
    }
    public void setIncludePublishArtifacts(boolean includePublishArtifacts) {
        this. = includePublishArtifacts;
    }
    public boolean isRunChecks() {
        return ;
    }
    public boolean isDisableLicenseAutoDiscovery() {
        return ;
    }
    public void setLicenseAutoDiscovery(boolean licenseAutoDiscovery) {
        this. = licenseAutoDiscovery;
    }
    public String getScopes() {
        return ;
    }
    public boolean isLicenseAutoDiscovery() {
        return ;
    }
    public void setRunChecks(boolean runChecks) {
        this. = runChecks;
    }
    public boolean isDeployArtifacts() {
        return ;
    }
        return ;
    }
    public boolean isDeployBuildInfo() {
        return ;
    }
    public boolean isIncludeEnvVars() {
        return ;
    }
    public String getArtifactoryName() {
        return  != null ? . : null;
    }
    public String getRepositoryKey() {
        return  != null ? . : null;
    }
    public void setViolationRecipients(String violationRecipients) {
        this. = violationRecipients;
    }
    public String getViolationRecipients() {
        return ;
    }
    public boolean isEnableIssueTrackerIntegration() {
        return ;
    }
    public void setEnableIssueTrackerIntegration(boolean enableIssueTrackerIntegration) {
        this. = enableIssueTrackerIntegration;
    }
    public boolean isAggregateBuildIssues() {
        return ;
    }
    public void setAggregateBuildIssues(boolean aggregateBuildIssues) {
        this. = aggregateBuildIssues;
    }
    public String getAggregationBuildStatus() {
        return ;
    }
    public void setAggregationBuildStatus(String aggregationBuildStatus) {
        this. = aggregationBuildStatus;
    }
    @Override
    public Collection<? extends ActiongetProjectActions(AbstractProject project) {
        return ActionableHelper.getArtifactoryProjectAction(.project);
    }
    @Override
    public Environment setUp(final AbstractBuild buildLauncher launcherfinal BuildListener listener)
            throws IOExceptionInterruptedException {
        File localDependencyFile = Which.jarFile(ArtifactoryBuildListener.class);
        final FilePath actualDependencyDir =
                PluginDependencyHelper.getActualDependencyDirectory(buildlocalDependencyFile);
                        getAggregationBuildStatus()).build();
        build.setResult(.);
        return new AntIvyBuilderEnvironment() {
            @Override
            public void buildEnvVars(Map<StringStringenv) {
                try {
                    ExtractorUtils.addBuilderInfoArguments(envbuildlistenercontextnull);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
            @Override
            public String getAdditionalArgs() {
                StringBuilder targets = new StringBuilder();
                String actualDependencyDirPath = actualDependencyDir.getRemote();
                actualDependencyDirPath = actualDependencyDirPath.replace('\\''/');
                actualDependencyDirPath = "\"" + actualDependencyDirPath + "\"";
                targets.append("-lib ").append(actualDependencyDirPath).append(" ");
                targets.append("-listener ").append("org.jfrog.build.extractor.listener.ArtifactoryBuildListener")
                        .append(" ");
                return targets.toString();
            }
        };
    }
        for (ArtifactoryServer server : servers) {
            if (server.getName().equals(getArtifactoryName())) {
                return server;
            }
        }
        return null;
    }
    @Override
    public DescriptorImpl getDescriptor() {
        return (DescriptorImplsuper.getDescriptor();
    }
    @Extension(optional = true)
    public static class DescriptorImpl extends BuildWrapperDescriptor {
        public DescriptorImpl() {
            super(ArtifactoryIvyConfigurator.class);
            load();
        }
        @Override
        public boolean isApplicable(AbstractProject<?, ?> item) {
            return "hudson.ivy.IvyModuleSet".equals(item.getClass().getName());
        }
        @Override
        public String getDisplayName() {
            return "Publish to Artifactory";
        }
        @Override
        public String getHelpFile() {
            return "/plugin/artifactory/ivy/help-publish.html";
        }
        @Override
        public boolean configure(StaplerRequest reqJSONObject jsonthrows FormException {
            req.bindParameters(this"ivy");
            save();
            return true;
        }
        public FormValidation doCheckArtifactoryName(@QueryParameter String value) {
            return FormValidations.validateInternetAddress(value);
        }
            return FormValidations.validateEmails(value);
        }

        
Returns the list of org.jfrog.hudson.ArtifactoryServer configured.

Returns:
can be empty but never null.
        public List<ArtifactoryServergetArtifactoryServers() {
            ArtifactoryBuilder.DescriptorImpl descriptor = (ArtifactoryBuilder.DescriptorImpl)
                    Hudson.getInstance().getDescriptor(ArtifactoryBuilder.class);
            return descriptor.getArtifactoryServers();
        }
        public boolean isJiraPluginEnabled() {
            return (Hudson.getInstance().getPlugin("jira") != null);
        }
    }

    
Convert any remaining local credential variables to a credentials object
    public static final class ConverterImpl extends OverridingDeployerCredentialsConverter {
        public ConverterImpl(XStream2 xstream) {
            super(xstream);
        }
    }

    

Deprecated:
Use org.jfrog.hudson.DeployerOverrider.getOverridingDeployerCredentials()
    @Deprecated
    private transient String username;

    

Deprecated:
Use org.jfrog.hudson.DeployerOverrider.getOverridingDeployerCredentials()
    @Deprecated
    private transient String password;
New to GrepCode? Check out our FAQ X