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

Handle profile activation property being null #270

Merged
merged 1 commit into from
Dec 15, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private MavenSettings buildSettings() {
p.getActivation() == null ? null : new ProfileActivation(
p.getActivation().isActiveByDefault(),
p.getActivation().getJdk(),
new ProfileActivation.Property(
p.getActivation().getProperty() == null ? null : new ProfileActivation.Property(
p.getActivation().getProperty().getName(),
p.getActivation().getProperty().getValue()
)
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/org/openrewrite/maven/BasicIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ void groupid_artifactid_should_be_ok(MavenExecutionResult result) {
.containsOnly("JAR will be empty - no content was marked for inclusion!");
}

@MavenTest
@MavenOption(value = MavenCLIOptions.SETTINGS, parameter = "settings.xml")
@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:dryRun")
void null_check_profile_activation(MavenExecutionResult result) {
assertThat(result)
.isSuccessful()
.out()
.info()
.anySatisfy(line -> assertThat(line).contains("Applying recipes would make no changes. No patch file generated."));

assertThat(result)
.isSuccessful()
.out()
.warn()
.isEmpty();
}

@MavenTest
@SystemProperty(value = "ossrh_snapshots_url", content = "https://oss.sonatype.org/content/repositories/snapshots")
@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:dryRun")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.openrewrite.maven</groupId>
<artifactId>null_check_profile_activation</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>BasicIT#null_check_profile_activation</name>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.format.AutoFormat</recipe>
</activeRecipes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>example_profile_id</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>example_repository_id</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</profile>
</profiles>

</settings>