Skip to content

Commit

Permalink
[JENKINS-51093] - Add support of artifacts from Incrementals repo (JE…
Browse files Browse the repository at this point in the history
…P-305)
  • Loading branch information
oleg-nenashev committed May 2, 2018
1 parent b3a78a6 commit ace264d
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 16 deletions.
Expand Up @@ -23,13 +23,12 @@
* @author Oleg Nenashev
* @since TODO
*/
public class MavenHPICustomWARPOMGenerator {
public class MavenHPICustomWARPOMGenerator extends POMGenerator {

private final Config config;
private final String outputFileSuffix;

public MavenHPICustomWARPOMGenerator(Config config, String outputFileSuffix) {
this.config = config;
super(config);
this.outputFileSuffix = outputFileSuffix;
}

Expand Down Expand Up @@ -77,11 +76,9 @@ public Model generatePOM(Map<String, String> versionOverrides) throws IOExceptio
</executions>
</plugin>
*/
Repository jenkinsRepository = new Repository();
jenkinsRepository.setId("repo.jenkins-ci.org");
jenkinsRepository.setUrl("https://repo.jenkins-ci.org/public/");
model.addPluginRepository(jenkinsRepository);
model.addRepository(jenkinsRepository);

// Maven repositories
addRepositories(model);

Plugin mavenHPIPlugin = new Plugin();
mavenHPIPlugin.setGroupId("org.jenkins-ci.tools");
Expand Down
Expand Up @@ -26,13 +26,12 @@
* @author Oleg Nenashev
* @since TODO
*/
public class MavenWARPackagePOMGenerator {
public class MavenWARPackagePOMGenerator extends POMGenerator {

private final Config config;
private final File sourceWar;

public MavenWARPackagePOMGenerator(Config config, File sourceWar) {
this.config = config;
super(config);
this.sourceWar = sourceWar;
}

Expand Down Expand Up @@ -87,11 +86,9 @@ public Model generatePOM(Map<String, String> injectedManifestEntries) throws IOE
</plugin>
</plugin
*/
Repository jenkinsRepository = new Repository();
jenkinsRepository.setId("repo.jenkins-ci.org");
jenkinsRepository.setUrl("https://repo.jenkins-ci.org/public/");
model.addPluginRepository(jenkinsRepository);
model.addRepository(jenkinsRepository);

// Maven repositories
addRepositories(model);

Plugin mavenHPIPlugin = new Plugin();
mavenHPIPlugin.setGroupId("org.apache.maven.plugins");
Expand Down
@@ -0,0 +1,35 @@
package io.jenkins.tools.warpackager.lib.impl;

import io.jenkins.tools.warpackager.lib.config.Config;
import org.apache.maven.model.Model;
import org.apache.maven.model.Repository;

/**
* @author Oleg Nenashev
* @since TODO
*/
public class POMGenerator {

protected final Config config;

public POMGenerator(Config config) {
this.config = config;
}

//TODO: support customization via build settings
protected void addRepositories(Model target) {
// Common repo
Repository jenkinsRepository = new Repository();
jenkinsRepository.setId("repo.jenkins-ci.org");
jenkinsRepository.setUrl("https://repo.jenkins-ci.org/public/");
target.addPluginRepository(jenkinsRepository);
target.addRepository(jenkinsRepository);

// Incrementals repo
Repository incrementals = new Repository();
incrementals.setId("incrementals");
incrementals.setUrl("https://repo.jenkins-ci.org/incrementals/");
target.addPluginRepository(incrementals);
target.addRepository(incrementals);
}
}
15 changes: 15 additions & 0 deletions custom-war-packager-maven-plugin/src/it/incrementals/config.yml
@@ -0,0 +1,15 @@
bundle:
groupId: "io.github.oleg-nenashev"
artifactId: "mywar"
description: "Test for incrementals"
war:
groupId: "org.jenkins-ci.main"
artifactId: "jenkins-war"
source:
git: https://github.com/jenkinsci/jenkins.git
version: 2.118
plugins:
- groupId: "org.jenkins-ci.plugins"
artifactId: "buildtriggerbadge"
source:
version: 2.10-rc129.5fad9a56d6e9
@@ -0,0 +1 @@
invoker.goals=clean package
35 changes: 35 additions & 0 deletions custom-war-packager-maven-plugin/src/it/incrementals/pom.xml
@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>io.jenkins.tools.war-packager.its</groupId>
<artifactId>incrementals</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>pom</packaging>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>custom-war</goal>
</goals>
<configuration>
<configFilePath>config.yml</configFilePath>
<warVersion>1.1-SNAPSHOT</warVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

0 comments on commit ace264d

Please sign in to comment.