ehcache / ehcache3

Ehcache 3.x line
http://www.ehcache.org
Apache License 2.0
2k stars 579 forks source link

Ehcache 3 and Ehcache 2 builds are broken #3145

Closed gregrluck closed 1 year ago

gregrluck commented 1 year ago

Hi

I thought I would dust off ehcache on its 20 year anniversary as part of an article I am writing. I was looking to build the software and have a play with it. But neither the 2 or 3 build is working. Details follow.

Ehcache 3 Build Java 17 Command line: ./gradlew build

The build fails. Following are some of the failures.

If there are switches that need to be added or other settings to make this build, what are they? The documentation is horribly out of date.

`

Task :clustered:server:ehcache-service:compileJava FAILED /Users/gluck/work/ehcache3/clustered/server/ehcache-service/src/main/java/org/ehcache/clustered/server/offheap/OffHeapChainStorageEngine.java:217: warning: [cast] redundant cast to ByteBuffer return (ByteBuffer)detachedContiguousBuffer.flip(); ^ /Users/gluck/work/ehcache3/clustered/server/ehcache-service/src/main/java/org/ehcache/clustered/server/offheap/OffHeapChainStorageEngine.java:702: warning: [cast] redundant cast to ByteBuffer final ByteBuffer detachedBuffer = (ByteBuffer) ByteBuffer.allocate(attachedBuffer.remaining()).put(attachedBuffer).flip(); ^ error: warnings found and -Werror specified 1 error 2 warnings

Task :ehcache-impl:compileUnsafeJava FAILED /Users/gluck/work/ehcache3/ehcache-impl/src/unsafe/java/org/ehcache/impl/internal/concurrent/ConcurrentHashMap.java:2583: error: cannot find symbol @sun.misc.Contended ^ symbol: class Contended location: package sun.misc /Users/gluck/work/ehcache3/ehcache-impl/src/unsafe/java/org/ehcache/impl/internal/concurrent/ThreadLocalRandomUtil.java:57: warning: [removal] AccessController in java.security has been deprecated and marked for removal return java.security.AccessController.doPrivileged `

Ehcache 2 Build I cannot create an issue on that repo, so adding it here. Java 17, Maven 3.9.0 Command: mvn clean install

Here the error is that a Terracotta maven repo is offline.

Is there some way this can be built without being a Software AG employee? What do you need to change?

[ERROR] Failed to execute goal org.terracotta:maven-forge-plugin:1.2.5:buildinfo (generateBuildInfoFile) on project ehcache-root: Execution generateBuildInfoFile of goal org.terracotta:maven-forge-plugin:1.2.5:buildinfo failed: Plugin org.terracotta:maven-forge-plugin:1.2.5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.terracotta:maven-forge-plugin:jar:1.2.5 -> com.softwareag.ibit.tools:finder:jar:2.05a: Failed to read artifact descriptor for com.softwareag.ibit.tools:finder:jar:2.05a: Could not transfer artifact com.softwareag.ibit.tools:finder:pom:2.05a from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [terracotta-snapshots (http://www.terracotta.org/download/reflector/snapshots, default, releases+snapshots), terracotta-releases (http://www.terracotta.org/download/reflector/releases, default, releases+snapshots)] -> [Help 1]

chrisdennis commented 1 year ago

Ehcache 3 still supports Java 8, so needs to be built with that. Mostly this is due to not wanting to scatter @SuppressWarnings throughout the source to suppress warnings that are Java 17 specific (deprecations/unneeded casts). If you want to build with 8 and test with 17 that can be done with:

./gradlew -PtestVM=<path-to-test-jvm> ...

Ehcache 2 should build fine outside of Software AG, but I doubt very many people do at this point. The errors you're seeing are due to later releases of Maven blocking usage of http URLs in repositories. It's relatively simple to fix this in your settings.xml by mirroring the repository at its own https url:

<mirror>
    <id>https-terracotta-releases</id>
    <name>HTTP unblock for terracotta-releases</name>
    <url>https://repo.terracotta.org/maven2</url>
    <mirrorOf>terracotta-releases</mirrorOf>
</mirror>

It's possible other things have bit-rotted and not been noticed due internal caching but at this point Ehcache 2 is 8 months from being completely EOLed (repository will go read-only). These kind of things could be fixed but they cause minimal hassle for the very minimal amounts of development that happens there at this point.