Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/main/resources/META-INF/rewrite/jacoco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright 2021 the original author or authors.
# <p>
# 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
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# 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.
#
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion
displayName: Upgrade JaCoCo Maven plugin version
description: This recipe will upgrade the JaCoCo Maven plugin to a more recent version compatible with Java 11.
tags:
- java11
- jacoco

recipeList:
- org.openrewrite.maven.UpgradePluginVersion:
groupId: org.jacoco
artifactId: jacoco-maven-plugin
newVersion: 0.8.7
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/rewrite/java8-to-java11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ recipeList:
- org.openrewrite.java.migrate.javax.JavaxLangModelUtil
- org.openrewrite.java.migrate.javax.JavaxManagementMonitorAPIs
- org.openrewrite.java.migrate.javax.JavaxXmlStreamAPIs
# Upgrade JaCoCo
- org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoVersion

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright 2022 the original author or authors.
* <p>
* 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.openrewrite.java.migrate.wro4j;

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.openrewrite.Recipe
import org.openrewrite.config.Environment
import org.openrewrite.maven.MavenRecipeTest

class UpgradeJaCoCoMavenPluginVersionTest : MavenRecipeTest {
override val recipe: Recipe = Environment.builder()
.scanRuntimeClasspath("org.openrewrite.java.migrate.jacoco")
.build()
.activateRecipes("org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion")

@Test
fun property() = assertChanged(
before = """
<project>
<modelVersion>4.0.0</modelVersion>

<properties>
<jacoco.version>0.8.1</jacoco.version>
</properties>

<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
""",
after = """
<project>
<modelVersion>4.0.0</modelVersion>

<properties>
<jacoco.version>0.8.7</jacoco.version>
</properties>

<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
"""
)
}