Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-20679] Try to declare the minimum Java version in the manifest #75

Merged
merged 9 commits into from
Dec 5, 2018
Merged
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ See the [developer guide](https://jenkins.io/doc/developer/plugin-development/)

## Changelog

### 3.0 (2018-11-30)

* [JENKINS-20679](https://issues.jenkins-ci.org/browse/JENKINS-20679) -
Inject `Minimum-Java-Version` into the manifest.
* It is set by a new mandatory `minimumJavaVersion` parameter in `hpi:hpi`, `hpi:jar` and `hpi:hpl`
* Format: `java.specification.version` according to [Java JEP-223](https://openjdk.java.net/jeps/223).
Examples: `1.6`, `1.7`, `1.8`, `6`, `7`, `8`, `9`, `11`, ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? That JEP seems to say the format should be 6, 7, etc., and not 1.6, 1.7, etc. as before. So which is the version format expected by this feature?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://openjdk.java.net/jeps/223 . 1.6 and 1.7 are the old formats of Java specification, we should not maintain them going forward imho

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so why would we support them at all in this newly added feature?

* Internal: Move manifest-related parameters and logic to `AbstractJenkinsManifestMojo`

### 2.7 (2018-10-30)

* Delete `work/plugins/*.jpl` where the current `test`-scoped dependency is not in fact a snapshot.
Expand Down Expand Up @@ -69,16 +78,16 @@ mvn -f ../some-plugin -Dhpi-plugin.version=2.XXX-SNAPSHOT -DskipTests -DjenkinsH
You can also rerun one test:

```bash
mvn -Prun-its mrm:start invoker:run mrm:stop -Dinvoker.test=parent-2x
mvn -Prun-its mrm:start invoker:run mrm:stop -Dinvoker.test=parent-3x
```

To rerun just the verification script:

```bash
groovy -e "basedir='$(pwd)/target/its/parent-2x'; evaluate new File('src/it/parent-2x/verify.groovy')"
groovy -e "basedir='$(pwd)/target/its/parent-3x'; evaluate new File('src/it/parent-3x/verify.groovy')"
```

Also make sure `project.parent.version` in `src/it/parent-2x/pom.xml` is the latest.
Also make sure `project.parent.version` in `src/it/parent-3x/pom.xml` is the latest.

## Updating Jetty
`hpi:run` mojo is a variant of `jetty:run` mojo, and because of the way plugin descriptor is generated, this module copies some code from Jetty Maven plugin, specifically `AbstractJettyMojo.java` and `ConsoleScanner.java`.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>2.8-SNAPSHOT</version>
<version>3.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Maven Jenkins Plugin</name>
Expand Down
6 changes: 3 additions & 3 deletions src/it/jitpack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.28</version>
<version>3.29-20181203.151310-8</version>
<relativePath/>
</parent>
<groupId>org.jenkins-ci.tools.hpi.its</groupId>
<artifactId>jitpack</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<jenkins.version>1.609.3</jenkins.version>
<java.level>6</java.level>
<jenkins.version>1.625.3</jenkins.version>
<java.level>7</java.level>
<hpi-plugin.version>@project.version@</hpi-plugin.version>
</properties>
<repositories>
Expand Down
8 changes: 4 additions & 4 deletions src/it/parent-2x/pom.xml → src/it/parent-3x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.28</version>
<version>3.29-20181203.151310-8</version>
<relativePath/>
</parent>
<groupId>org.jenkins-ci.tools.hpi.its</groupId>
<artifactId>parent-2x</artifactId>
<artifactId>parent-3x</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<jenkins.version>2.19.2</jenkins.version>
<java.level>7</java.level>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
<hpi-plugin.version>@project.version@</hpi-plugin.version>
<no-test-jar>false</no-test-jar>
</properties>
Expand Down
24 changes: 12 additions & 12 deletions src/it/parent-2x/verify.groovy → src/it/parent-3x/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import java.util.jar.*

assert new File(basedir, 'target/parent-2x.hpi').exists()
assert new File(basedir, 'target/parent-2x.jar').exists()
assert new File(basedir, 'target/parent-3x.hpi').exists()
assert new File(basedir, 'target/parent-3x.jar').exists()

File installed = new File(basedir, '../../local-repo/org/jenkins-ci/tools/hpi/its/parent-2x/1.0-SNAPSHOT/')
File installed = new File(basedir, '../../local-repo/org/jenkins-ci/tools/hpi/its/parent-3x/1.0-SNAPSHOT/')
assert installed.directory

def checkArtifact(File installed, String artifact, List<String> expectedEntries, List<String> unexpectedEntries, Map<String,String> expectedManifestEntries) {
Expand All @@ -20,34 +20,34 @@ def checkArtifact(File installed, String artifact, List<String> expectedEntries,
}
}

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT.hpi',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT.hpi',
// TODO could also check src/main/webapp/images/32x32/foo.png → images/32x32/foo.png
['WEB-INF/lib/parent-2x.jar'],
['WEB-INF/lib/parent-3x.jar'],
// TODO still some problems with unwanted transitive JAR dependencies creeping in, e.g. WEB-INF/lib/jboss-marshalling-1.4.9.Final.jar in workflow-multibranch.hpi, or all kinds of junk in parameterized-trigger.hpi
['test/SampleRootAction.class', 'WEB-INF/lib/symbol-annotation-1.5.jar'],
['Short-Name': 'parent-2x', 'Group-Id': 'org.jenkins-ci.tools.hpi.its', 'Jenkins-Version': '2.19.2' /* Plugin-Version unpredictable for a snapshot */, 'Plugin-Dependencies': 'structs:1.5'])
['Short-Name': 'parent-3x', 'Group-Id': 'org.jenkins-ci.tools.hpi.its', 'Jenkins-Version': '2.60.3' /* Plugin-Version unpredictable for a snapshot */, 'Plugin-Dependencies': 'structs:1.5'])

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT.jar',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT.jar',
['META-INF/annotations/hudson.Extension', 'test/SampleRootAction.class', 'index.jelly'],
[],
['Short-Name': 'parent-2x'])
['Short-Name': 'parent-3x'])

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT-javadoc.jar',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT-javadoc.jar',
['test/SampleRootAction.html'],
[],
[:])

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT-sources.jar',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT-sources.jar',
['test/SampleRootAction.java', 'index.jelly'],
[],
[:])

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT-tests.jar',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT-tests.jar',
['test/SampleRootActionTest.class', 'test/expected.txt'],
['the.hpl', 'InjectedTest.class', 'test-dependencies/structs.hpi'],
[:])

checkArtifact(installed, 'parent-2x-1.0-SNAPSHOT-test-sources.jar',
checkArtifact(installed, 'parent-3x-1.0-SNAPSHOT-test-sources.jar',
['test/SampleRootActionTest.java', 'test/expected.txt'],
['InjectedTest.java'],
[:])
Expand Down
13 changes: 7 additions & 6 deletions src/it/process-jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.424</version>
<version>3.29-20181203.151310-8</version>
</parent>

<groupId>org.jenkins-ci.tools.hpi.its</groupId>
Expand All @@ -15,6 +15,11 @@

<packaging>hpi</packaging>

<properties>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
</properties>

<name>MyNewPlugin</name>

<dependencies>
Expand All @@ -34,11 +39,6 @@
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</plugin>
<plugin>
<groupId>org.kohsuke</groupId>
<artifactId>access-modifier-checker</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand All @@ -60,6 +60,7 @@
</executions>
<configuration>
<jarClassifier>shaded</jarClassifier>
<minimumJavaVersion>8</minimumJavaVersion>
</configuration>
</plugin>
<!-- TODO the shade plugin doesn't like shading the non-main attached artifacts yet -->
Expand Down
12 changes: 6 additions & 6 deletions src/it/snapshot-version-override/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.424</version>
<version>3.29-20181203.151310-8</version>
</parent>

<groupId>org.jenkins-ci.tools.hpi.its</groupId>
Expand All @@ -16,6 +16,11 @@

<name>MyNewPlugin</name>

<properties>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
</properties>

<scm>
<connection>scm:git:git://github.com/jenkinsci/maven-hpi-plugin.git</connection>
<developerConnection>scm:git:ssh://[email protected]/jenkinsci/maven-hpi-plugin.git</developerConnection>
Expand All @@ -31,11 +36,6 @@
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</plugin>
<plugin>
<groupId>org.kohsuke</groupId>
<artifactId>access-modifier-checker</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down
12 changes: 6 additions & 6 deletions src/it/verify-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.424</version>
<version>3.29-20181203.151310-8</version>
</parent>

<groupId>org.jenkins-ci.tools.hpi.its</groupId>
Expand All @@ -16,6 +16,11 @@

<name>MyNewPlugin</name>

<properties>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
</properties>

<build>
<pluginManagement>
<plugins>
Expand All @@ -24,11 +29,6 @@
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
</plugin>
<plugin>
<groupId>org.kohsuke</groupId>
<artifactId>access-modifier-checker</artifactId>
<version>1.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down
Loading