• ■ ■ ■ ■ ■ ■
    src/main/java/io/onedev/plugin/maven/PluginUtils.java
    skipped 121 lines
    122 122   }
    123 123   
    124 124   public static boolean isRuntimeArtifact(Artifact artifact) {
    125  - return artifact.getScope().equals(Artifact.SCOPE_COMPILE) || artifact.getScope().equals(Artifact.SCOPE_RUNTIME)
    126  - || artifact.getScope().equals(Artifact.SCOPE_SYSTEM);
     125 + return !artifact.hasClassifier() &&
     126 + (artifact.getScope().equals(Artifact.SCOPE_COMPILE) || artifact.getScope().equals(Artifact.SCOPE_RUNTIME) || artifact.getScope().equals(Artifact.SCOPE_SYSTEM));
    127 127   }
    128 128  
    129 129   public static void writeClasspath(File file, MavenProject project, RepositorySystem repoSystem,
    skipped 404 lines
  • ■ ■ ■ ■ ■
    src/main/java/io/onedev/plugin/maven/PopulateAgentResourcesMojo.java
    skipped 36 lines
    37 37   StringBuffer buffer = new StringBuffer();
    38 38   for (Artifact artifact: project.getArtifacts()) {
    39 39   if (PluginUtils.isRuntimeArtifact(artifact)) {
    40  - buffer.append(artifact.getGroupId()).append(".").append(artifact.getArtifactId())
    41  - .append("-").append(artifact.getVersion()).append(";");
     40 + buffer.append(artifact.getGroupId()).append(".")
     41 + .append(artifact.getArtifactId()).append(":")
     42 + .append(artifact.getVersion()).append(";");
    42 43   }
    43 44   }
    44 45   props.put("dependencies", buffer.toString());
    skipped 8 lines
  • ■ ■ ■ ■ ■ ■
    src/main/java/io/onedev/plugin/maven/PopulateResourcesMojo.java
    skipped 4 lines
    5 5  import java.util.ArrayList;
    6 6  import java.util.Collections;
    7 7  import java.util.Comparator;
     8 +import java.util.HashMap;
    8 9  import java.util.HashSet;
    9 10  import java.util.List;
     11 +import java.util.Map;
    10 12  import java.util.Properties;
    11 13  import java.util.Set;
    12 14   
    skipped 11 lines
    24 26  import org.eclipse.aether.RepositorySystem;
    25 27  import org.eclipse.aether.RepositorySystemSession;
    26 28  import org.eclipse.aether.repository.RemoteRepository;
     29 + 
     30 +import com.google.common.base.Splitter;
    27 31   
    28 32  /**
    29 33   * @goal populate-resources
    skipped 127 lines
    157 161  
    158 162   File sandboxDir = new File(buildDir, PluginConstants.SANDBOX);
    159 163   if (executables != null) {
     164 + Properties agentProps = null;
     165 + for (Artifact artifact: project.getArtifacts()) {
     166 + if (PluginUtils.isRuntimeArtifact(artifact)) {
     167 + agentProps = PluginUtils.loadProperties(
     168 + artifact.getFile(), PluginConstants.AGENT_PROPERTY_FILE);
     169 + if (agentProps != null)
     170 + break;
     171 + }
     172 + }
     173 + if (agentProps != null) {
     174 + Map<String, String> agentDependencyVersions = new HashMap<>();
     175 + for (String dependency: Splitter.on(";").omitEmptyStrings().split(agentProps.getProperty("dependencies"))) {
     176 + int index = dependency.indexOf(':');
     177 + agentDependencyVersions.put(dependency.substring(0, index), dependency.substring(index+1));
     178 + }
     179 + for (Artifact artifact: project.getArtifacts()) {
     180 + if (PluginUtils.isRuntimeArtifact(artifact)) {
     181 + String dependency = artifact.getGroupId() + "." + artifact.getArtifactId();
     182 + String version = agentDependencyVersions.get(dependency);
     183 + if (version != null && !version.equals(artifact.getVersion())) {
     184 + String errorMessage = String.format(
     185 + "Inconsistent dependency version in agent and product (groupId: %s, artifactId: %s, version in agent: %s, version in product: %s)",
     186 + artifact.getGroupId(), artifact.getArtifactId(), version, artifact.getVersion());
     187 + throw new RuntimeException(errorMessage);
     188 + }
     189 + }
     190 + }
     191 + }
     192 +
    160 193   props = new Properties();
    161 194   props.put("executables", executables);
    162 195   
    skipped 89 lines
Please wait...
Page is in error, reload to recover