Errors in sbt Scala project - macos

Created a sample Scala project structure (on my OS X Mavericks based computer) as follows:
Inside sample_project dir:
src
main
java
scala
Hello.scala
resources
test
java
scala
resources
build.sbt
Hello.scala:
object Hello {
def main(args: Array[String]) = println("Hello!")
}
build.sbt:
name := "hello"
version := "1.0"
scalaVersion := "2.11.1"
Placed the build.properties under sample_project/project:
sbt.version=0.13.5
When I try to run it using the "sbt" command inside the root folder:
/sample_project $ sbt
Getting org.scala-tools.sbt sbt_2.8.1 0.13.5 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-tools.sbt#sbt_2.8.1;0.13.5
==== local: tried
.ivy2/local/org.scala-tools.sbt/sbt_2.8.1/0.13.5/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
.ivy2/local/org.scala-tools.sbt/sbt_2.8.1/0.13.5/jars/sbt_2.8.1.jar
==== Maven2 Local: tried
file://.m2/repository/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.pom
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
file://.m2/repository/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.jar
==== typesafe-ivy-releases: tried
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.8.1/0.13.5/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.8.1/0.13.5/jars/sbt_2.8.1.jar
==== Maven Central: tried
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.pom
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.jar
==== Scala-Tools Maven2 Repository: tried
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.pom
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.jar
==== Scala-Tools Maven2 Snapshots Repository: tried
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.pom
-- artifact org.scala-tools.sbt#sbt_2.8.1;0.13.5!sbt_2.8.1.jar:
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.8.1/0.13.5/sbt_2.8.1-0.13.5.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.8.1;0.13.5: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-tools.sbt#sbt_2.8.1;0.13.5: not found
Error during sbt execution: Error retrieving required libraries
(see sample_project/project/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.5

This looks like an sbt version mismatch. Create a project directory under sample_project and inside it create a file called build.properties with the following contents:
sbt.version=0.13.5

It seems you have an old launcher version of sbt, perhaps even too old to cope with the new 0.13.5.
Try to update your launcher to the latest version. On MacOS, the easiest way is to use the Homebrew package manager. If not already done, install it with:
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
then, install sbt:
$ brew install sbt

Related

Apache Groovy project `gradlew clean dist` fails under JDK 16.0.2 with '/SharedConfiguration...compiled by a more recent of Java...version 61.0

I'm trying to build the Apache Groovy project. The Apache Groovy project recommends asking questions on Slack or StackOverflow. I haven't received the email for Slack invite, so I'm trying StackOverflow first.
Per the README.adoc, I'm using Java 16+. I don't see any other requirements or setup required per the README.adoc, unless I missed something. I appreciate any help.
From a clean git clone of the Apache Groovy project I run ./gradlew clean dist and get the following error:
org/apache/groovy/gradle/SharedConfiguration has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file v
ersions up to 60.0
This can be reproduced as follows:
mkdir groovy-jdk16 && cd "$_"
java -version # initially java is not found (i.e. no conflicting versions)
export PATH="/c/java/jdk-16.0.2/bin:$PATH"
java -version
git clone https://github.com/apache/groovy.git
cd groovy/
./gradlew clean dist
LOG for JDK 16.0.2:
groovy $mkdir groovy-jdk16 && cd "$_"
groovy-jdk16 $java -version # initially java is not found (i.e. no conflicting versions)
bash: java: command not found
groovy-jdk16 $export PATH="/c/java/jdk-16.0.2/bin:$PATH"
groovy-jdk16 $java -version
openjdk version "16.0.2" 2021-07-20
- okio-jvm-2.10.0.jar (com.squareup.okio:okio:2.10.0) from repository Gradle Central Plugin Repository
This can indicate that a dependency has been compromised. Please carefully verify the signatures and checksums.
Open this report for more details: file:///C:/projects/groovy/groovy-jdk16/groovy/build/reports/dependency-verification/at-1671383936580/dependency-verification-report.html
This build uses Gradle Build Scans to gather statistics, share information about
failures, environmental issues, dependencies resolved during the build and more.
Build scans will be published after each build, if you accept the terms of
service, and in particular the privacy policy.
Please read
https://gradle.com/terms-of-service
https://gradle.com/legal/privacy
and then:
- set the `GRADLE_SCANS_ACCEPT` to `yes`/`no` if you agree with/refuse the TOS
- or create the C:\Users\me\.gradle\gradle-scans-license-agree.txt file with `yes`/`no` in it if you agree with/refuse
And we'll not bother you again. Note that build scans are only made public if
you share the URL at the end of the build.
FAILURE: Build failed with an exception.
* What went wrong:
org/apache/groovy/gradle/SharedConfiguration has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recog
nizes class file versions up to 60.0
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
8 actionable tasks: 3 executed, 5 from cache
groovy $
TRY JDK 17.0.2
I see a lot of references to JDK 17 "sealed" classes in the code, so tried JDK 17.0.2 which results in the following error: java.lang.ClassNotFoundException: precompiled_OrgApacheGroovyBadPracticesDetection
This can be reproduced as follows:
mkdir groovy-jdk17 && cd "$_"
java -version # initially java is not found (i.e. no conflicting versions)
export PATH="/c/java/jdk-17.0.2/bin:$PATH"
java -version
git clone https://github.com/apache/groovy.git
cd groovy/
./gradlew clean dist
LOG for JDK 17.0.2:
groovy $mkdir groovy-jdk17 && cd "$_"
java -version
git clone https://github.com/apache/groovy.git
cd groovy/
./gradlew clean dist
groovy-jdk17 $java -version # initially java is not found (i.e. no conflicting versions)
bash: java: command not found
groovy-jdk17 $export PATH="/c/java/jdk-17.0.2/bin:$PATH"
groovy-jdk17 $java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
groovy-jdk17 $git clone https://github.com/apache/groovy.git
Cloning into 'groovy'...
remote: Enumerating objects: 401543, done.
remote: Counting objects: 100% (2177/2177), done.
remote: Compressing objects: 100% (811/811), done.
remote: Total 401543 (delta 1253), reused 2063 (delta 1143), pack-reused 399366
Receiving objects: 100% (401543/401543), 203.41 MiB | 2.73 MiB/s, done.
Resolving deltas: 100% (249207/249207), done.
Updating files: 100% (4979/4979), done.
groovy-jdk17 $cd groovy/
groovy $./gradlew clean dist
Type-safe project accessors is an incubating feature.
> Task :build-logic:compileJava FROM-CACHE
Dependency verification failed for configuration ':build-logic:compileClasspath'
One artifact failed verification: build-info-extractor-gradle-4.30.1.jar (org.jfrog.buildinfo:build-info-extractor-gradle:4.30.1) from repository Gradle Central Plugin Repository
This can indicate that a dependency has been compromised. Please carefully verify the signatures and checksums.
Open this report for more details: file:///C:/projects/groovy/groovy-jdk17/groovy/build/reports/dependency-verification/at-1671384519313/dependency-verification-report.html
> Configure project :
Dependency verification failed for configuration ':classpath'
5 artifacts failed verification:
- build-info-extractor-gradle-4.30.1.jar (org.jfrog.buildinfo:build-info-extractor-gradle:4.30.1) from repository Gradle Central Plugin Repository
- moshi-1.12.0.jar (com.squareup.moshi:moshi:1.12.0) from repository Gradle Central Plugin Repository
- moshi-kotlin-1.12.0.jar (com.squareup.moshi:moshi-kotlin:1.12.0) from repository Gradle Central Plugin Repository
- okhttp-4.9.3.jar (com.squareup.okhttp3:okhttp:4.9.3) from repository Gradle Central Plugin Repository
- okio-jvm-2.10.0.jar (com.squareup.okio:okio:2.10.0) from repository Gradle Central Plugin Repository
This can indicate that a dependency has been compromised. Please carefully verify the signatures and checksums.
Open this report for more details: file:///C:/projects/groovy/groovy-jdk17/groovy/build/reports/dependency-verification/at-1671384519313/dependency-verification-report.html
This build uses Gradle Build Scans to gather statistics, share information about
failures, environmental issues, dependencies resolved during the build and more.
Build scans will be published after each build, if you accept the terms of
service, and in particular the privacy policy.
Please read
https://gradle.com/terms-of-service
https://gradle.com/legal/privacy
and then:
- set the `GRADLE_SCANS_ACCEPT` to `yes`/`no` if you agree with/refuse the TOS
- or create the C:\Users\me\.gradle\gradle-scans-license-agree.txt file with `yes`/`no` in it if you agree with/refuse
And we'll not bother you again. Note that build scans are only made public if
you share the URL at the end of the build.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\projects\groovy\groovy-jdk17\groovy\build.gradle' line: 25
* What went wrong:
An exception occurred applying plugin request [id: 'org.apache.groovy-core']
> Failed to apply plugin 'org.apache.groovy-core'.
> Failed to apply plugin 'org.apache.groovy-common'.
> Failed to apply plugin 'org.apache.groovy-bad-practices-detection'.
> java.lang.ClassNotFoundException: precompiled_OrgApacheGroovyBadPracticesDetection
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
8 actionable tasks: 3 executed, 5 from cache
groovy $
DOH! After switching to the GROOVY_4_0_6 tag branch, ./gradlew clean dist completes successfully under JDK 17.0.2. The issue reported above only occurs on the master branch.

Maven error when attempting to build a zookeeper rpm package

Trying to build an zookeeper rpm package.
In .spec file have specified:
BuildRequires: python-devel,gcc,make,libtool,autoconf,cppunit-devel,hostname,systemd,maven
But does not seem to like the version of maven used:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (banned-commons-lang) on project parent: A type incompatibility occured while executing org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce: org.sonatype.aether.util.DefaultRepositorySystemSession cannot be cast to org.eclipse.aether.RepositorySystemSession
Is there a way I can force it to use a newer maven like https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
That I have been advised works ok with zookeeper 3.8.0?
Have tried specifying BuildRequires >=3.8.6
But results in this error:
Error: No Package found for maven >= 3.8.6
Any help appreciated - very new to builds.
Thanks khmarbaise, pointed me in the right direction, in the .spec file I added the following to use the latest maven:
Added new source entry for maven repo in package info section:
Source5: https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
%prep
tar xvf %SOURCE5 -C /usr/local/**
%build
/usr/local/apache-maven-3.8.6/bin/mvn -DskipTests package
Now .rpm files generated as expected.

addSbtPlugin without scala version

I am trying to use the babel webjar plugin in my project that is built with playframework 2.5, which basically runs sbt to build the project.
When I put
addSbtPlugin("org.webjars" %% "babel" % "6.3.26-1" )
in project/plugins.sbt, I get this error:
[info] Resolving org.webjars#babel;6.3.26-1 ...
[warn] module not found: org.webjars#babel;6.3.26-1
<trying other repositories>
[warn] https://repo1.maven.org/maven2/org/webjars/babel_2.10_0.13/6.3.26-1/babel-6.3.26-1.pom
The pom file is located at http://repo1.maven.org/maven2/org/webjars/babel/6.3.26-1/babel-6.3.26-1.pom. This is almost the address that sbt tried, but sbt added the scala version.
Is there a way to tell sbt to not add the scala version? I tried this version and a single percent sign, and both of them added the scala version.
I am using sbt 0.13.9.

Cannot find parent: net.java:jvnet-parent for project: com.sun.jersey:jersey-project:pom:1.9

My project invloves of spring-data-neo4j,when runnging mvn clean install,
there is a maven build error.
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.sun.jersey:jersey-project:pom:1.9
Reason: Cannot find parent: net.java:jvnet-parent for project: com.sun.jersey:jersey-project:pom:1.9 for project com.sun.jersey:jersey-project:pom:1.9
"The root cause is a deficiency in Maven 2.2.1. It's not following 301 redirects; if you look at the .pom that is downloaded into your local repository, you will see the 301 HTML that was delivered from the server. More information is available at http://jira.codehaus.org/browse/WAGON-314 . It sounds like the only workaround is to either downgrade to 2.2.0, or upgrade to a newer version of Maven 3." (mrandall_cerner_com at https://java.net/jira/browse/JERSEY-1080 )
I second the issue here with specific version of maven installation. 2.2.1
Steps for resolution : (Assuming you have ubuntu)
If maven (2.2.1) is already installed :
sudo apt-get remove maven2 [To uninstall current maven 2.2.1]
sudo apt-get install maven [Will install upgraded version]
Verify :
mvn --version [Expect to display 3.*]
Try this and see:
Go to Eclipse-> Window-> Preferences->Maven->User Settings
Copy the local repository path of your machine
Navigate to .m2\repository\com\sun\jersey\jersey-project and clean all folders
if jersey-project folder is not there then
clean .m2\repository\com\sun\jersey contents..
Then on you project update you maven depencies (then check if all jars are downloaded to .m2\repository\com\sun\jersey folder)

Install fail for Maven 3.0.4

CentOS with java 1.4.2 and ant 1.6.5
Download maven 3.0.4 source
export M2_HOME=$HOME/maven/
ant
I then get following log. Couldn't find anything on google. Suggestions appreciated.
Buildfile: build.xml
clean-bootstrap:
initTaskDefs:
[echo] Building Apache Maven ...
isMavenHomeSet:
init:
[echo] maven.home = /home/larryk/maven/
[echo] maven.repo.local = /home/larryk/.m2/repository
[echo] distributionId = apache-maven
[echo] distributionName = Apache Maven
[echo] distributionDirectory = apache-maven
prompt-maven-home-exists:
pull:
[artifact:pom] -----------------------------------------------------
[artifact:pom] this realm = plexus.core
[artifact:pom] Number of imports: 0
[artifact:pom] -----------------------------------------------------
[artifact:pom] An error has occurred while processing the Maven artifact tasks.
[artifact:pom] Diagnosis:
[artifact:pom]
[artifact:pom] Unable to find component: org.apache.maven.project.MavenProjectBuilder
[artifact:pom] java.util.concurrent.BlockingQueue
BUILD FAILED
/home/downloads/apache-maven-3.0.4/build.xml:105: Unable to find component: org.apache.maven.project.MavenProjectBuilder
Total time: 1 second
Added
Thanks to #sparc_speed, I found the problem.
First issue was to upgrade to current Java. I used yum to automatically update the system. That brought me Java 1.6. Unfortunately that didn't solve the build problem--exact same error as before.
Turns out that yum had updated Java to 1.6. But yum didn't automatically upgrade the libraries. After the yum upgrade, these packages were on the system:
java-1.4.2-gcj-compat.i386
java-1.4.2-gcj-compat-devel.i386
java-1.6.0-openjdk.i386
Answer was to manually use yum to install the latest libraries:
sudo yum install java-1.6.0-openjdk-devel.i386
Note that maven still doesn't build:
BUILD FAILED
/home/downloads/apache-maven-3.0.4/build.xml:228: Syntax error in property: ${
but that's their problem, I'll file a bug with them.
Ant 1.8+ required Looks like the build error is a doc error that was fixed on the maven website but not in the project's README.bootstrap.txt file.
I'll file a bug against the readme file.
Bug report filed
You mentioned that you were using Java 1.4 - you probably need to upgrade. It would seem from this error message that Maven 3.0 needs java.util.concurrent.BlockingQueue, which was first added to Java in 1.5

Resources