Skip to content

Commit

Permalink
GH-299: Add reproduction for GH-299 dependency issue
Browse files Browse the repository at this point in the history
Adds a dependency on the latest version of ehcache at the time
of writing which references an invalid version of JAXB internally
which is unavailable on most modern JDKs.
  • Loading branch information
ascopes committed Jul 21, 2024
1 parent 8a96b72 commit 77a08d6
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (C) 2023 - 2024, Ashley Scopes.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#

invoker.goals = clean package
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2023 - 2024, Ashley Scopes.
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
http://www.apache.org/licenses/LICENSE-2.0
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.
-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>@project.groupId@</groupId>
<artifactId>protobuf-maven-plugin-parent</artifactId>
<version>@project.version@</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>

<groupId>gh-299-ehcache-jaxb-resolution-failure</groupId>
<artifactId>gh-299-ehcache-jaxb-resolution-failure</artifactId>

<properties>
<protobuf.version>4.27.2</protobuf.version>
<ehcache.version>3.10.8</ehcache.version>
</properties>

<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>

<dependency>
<!-- This version of ehcache pulls in an invalid system-path JAXB dependency that does not
exist on newer JDKs. In GH-299, we were erroneously trying to resolve that dependency,
despite it only being marked with the `runtime' scope, which we should have been
ignoring.
If this build succeeds, it means we no longer have an issue with this specific dependency
and that GH-299 has been fixed. -->
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
<classifier>jakarta</classifier>

<exclusions>
<exclusion>
<!-- This points to blocked repositories. -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>

<configuration>
<protocVersion>${protobuf.version}</protocVersion>
</configuration>

<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2023 - 2024, Ashley Scopes.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
if ("uname -o".execute().text =~ /Android.*/) {
println("Skipping test as it uses incompatible binaries for Android")
return false
} else {
return true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Copyright (C) 2023 - 2024, Ashley Scopes.
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.
//

syntax = "proto3";

option java_multiple_files = true;
option java_package = "org.example.helloworld";

package org.example.helloworld;

message GreetingRequest {
string name = 1;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2023 - 2024, Ashley Scopes.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

import java.nio.file.Path

import static org.assertj.core.api.Assertions.assertThat

Path expectedClass = basedir.toPath().toAbsolutePath().resolve("target")
.resolve("classes")
.resolve("org")
.resolve("example")
.resolve("helloworld")
.resolve("GreetingRequest.class")

// Verify compilation succeeded.
assertThat(expectedClass)
.isRegularFile()

return true

0 comments on commit 77a08d6

Please sign in to comment.