Spring Initializr is a open source project , which can be downloaded/cloned from github to run our own spring initializr. however the build of the project is maven. I want to convert it to gradle. Can anyone Help ?
I tried it with gradle init and gradle build
Gradle init is creating build.gradle and settings.gradle but gradle build is giving error.
Can someone try and post the solution
Thanks in advance
Error Details :
Task :initializr-actuator:compileTestJava FAILED
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:19: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:35: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\info\BomRangesInfoContributorTests.java:24: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\metric\ProjectGenerationMetricsListenerTests.java:28: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\AbstractInitializrStatTests.java:23: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:24: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:56: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
7 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':initializr-actuator:compileTestJava'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
11 actionable tasks: 1 executed, 10 up-to-date
Instead of converting that you can generate fresh project from following url:
https://start.spring.io/
Select Gradle Project and download the code.
Related
I have started using Gradle 7.2 to build a project that produces a compressed Tar archive. Gradle is issuing a deprecation warning that baseName is deprecated and should be replaced with archiveBaseName. But it rejects archiveBaseName.
A very much simplified example using a trivial Gradle build script, with their associated execution outputs are given below. I did run 'gradle --stop' to ensure a prior version's daemon wasn't actually executing; a GRADLE_HOME environment variable is pointing to the correct Gradle folder (not sure it's needed, but it is set.)
I tried using "archiveBaseName" both without and with "=" ("archiveBaseName 'Test'" and "archiveBaseName='Test'").
The docs seem to suggest archiveBaseName should already be available, so I don't think it's just a heads up of things to come.
Thank you!
Gradle file:
task dist(type: Tar) {
baseName 'Test'
into ('.') { from('.') }
}
Execution:
gradle build --warning-mode=all
c:\jdev\newpaas\xxx>gradle build --warning-mode all
> Configure project :
The AbstractArchiveTask.baseName property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the archiveBaseName property instead. See https://docs.gradle.org/7.2/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:baseName for more details.
at build_2qa2gx0itzunotwyc4ndf9v86$_run_closure1.doCall(C:\jdev\newpaas\xxx\build.gradle:2)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
> Task :buildEnvironment
------------------------------------------------------------
Root project 'TestProject'
------------------------------------------------------------
classpath
No dependencies
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 983ms
1 actionable task: 1 executed
Gradle file:
task dist(type: Tar) {
archiveBaseName 'Test'
into ('.') { from('.') }
}
Execution:
c:\jdev\newpaas\xxx>gradle build --warning-mode all
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\jdev\newpaas\xxx\build.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'TestProject'.
> Could not find method archiveBaseName() for arguments [Test] on task ':dist' of type org.gradle.api.tasks.bundling.Tar.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Gradle file:
task dist(type: Tar) {
archiveBaseName='Test'
into ('.') { from('.') }
}
Execution:
c:\jdev\newpaas\xxx>gradle dist
> Task :dist FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':dist' (type 'Tar').
- Type 'org.gradle.api.tasks.bundling.Tar' property 'archiveFile' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
1. Assign a value to 'archiveFile'.
2. Mark property 'archiveFile' as optional.
Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#value_not_set for more details about this problem.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
I stumbled across this syntax and it seems to be working for me:
archiveFileName = "${archiveBaseName}-${archiveVersion}.${archiveExtension}"
I have followed all the steps to implement the image picker plugin in a fresh new app.
Added dependencies to pubspec.yaml
dependencies:
image_picker: 0.6.2+3
Added to the menifest
android:requestLegacyExternalStorage="true"
Followed the example code, But I am getting is this error..
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
../project/android/app/src/main/AndroidManifest.xml:9:5-53:19: AAPT: error: attribute android:requestLegacyExternalStorage not found.
and
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:22: error: cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
Whats the wrong am I doing here!
After an intensive search, i got the clue to solved this issue. The app need to compile against SDK 29, which is the latest buildTool includes the latest changes that were introduced in Android 10.
Inside app level build.gradle file
// ...
android {
compileSdkVersion 29
// ....
defaultConfig {
targetSdkVersion 29
//...
I think this should be mentioned in the image_picker documentation.
how do I add the javafx dependencies through gradle?
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$ gradle clean
> Configure project :
e: /home/thufir/NetBeansProjects/helloWorldJavaFX/build.gradle.kts:13:7: Unresolved reference: openjfx
FAILURE: Build failed with an exception.
* Where:
Build file '/home/thufir/NetBeansProjects/helloWorldJavaFX/build.gradle.kts' line: 13
* What went wrong:
Script compilation error:
Line 13: org.openjfx.javafxplugin
^ Unresolved reference: openjfx
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$
the manual says:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
my build file has:
plugins {
// Apply the java plugin to add support for Java
java
org.openjfx.javafxplugin
// Apply the application plugin to add support for building an application
application
}
which is generating the above error.
in the plugins-section you have to put
id("org.openjfx.javafxplugin") version "0.0.8"
instead of just org.openjfx.javafxplugin.
After that you can put a javafx-section like
javafx {
modules("javafx.controls", "javafx.fxml")
}
somewhere (I prefere to put it next to the dependency-section). Here you can put in any module you need.
For further configuration posibilities have a look JavaFX Gradle Plugin.
Repo with a tight reproduction of my problem: https://github.com/paul-hammant/kotlin-webdriver-snafu
The spec, that could not be simpler:
class WebDriverSpeks : Spek({
ChromeDriverManager.getInstance().setup()
val co = ChromeOptions()
val chromeDriver = ChromeDriver(co) as WebDriver
beforeGroup {
chromeDriver.get("https://yahoo.com/")
}
describe("yahoo") {
it("should have index.html") {
assertEquals(chromeDriver.title, "hello")
}
}
afterGroup {
chromeDriver.close()
}
})
There's no red lines denoting compile failures in Intellij, yet when the gradle build runs it complains about a transitive dep:
$ gradle build
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.24/slf4j- api-1.7.24.jar
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.30/f916048adc012c9342b796a5f84c0ac6205abcac/kotlin-stdlib-jdk8-1.2.30.jar (version 1.2)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.30/ca12c47fc1e3a7316067b2a51e2f214745ebf8c5/kotlin-stdlib-jdk7-1.2.30.jar (version 1.2)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.0.6/3d499d3b7768f88c4796e5a1e357933e11a8936d/kotlin-reflect-1.0.6.jar (version 1.0)
/Users/paul/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.30/2dfac33f8b4e92c9dd1422cd286834701a6f6d6/kotlin-stdlib-1.2.30.jar (version 1.2)
w: Consider providing an explicit dependency on kotlin-reflect 1.2 to prevent strange errors
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath or use '-Xskip-runtime-version-check' to suppress this warning
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class org.openqa.selenium.chrome.ChromeDriver, unresolved supertypes: org.openqa.selenium.remote.RemoteWebDriver
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
5 actionable tasks: 5 executed
The allegedly unresolved supertype org.openqa.selenium.remote.RemoteWebDriver is in a selenium-remote-driver, and
If I delete ~/.gradle or ./build and try again it is the same.
If I inspect the pom.xml for selenium-java, I can see a dependency on selenium-remote-driver (which exists). See here - http://central.maven.org/maven2/org/seleniumhq/selenium/selenium-java/3.11.0/selenium-java-3.11.0.pom. The one in jcenter is the same.
I don't know why Gradle isn't finding selenium-remote-driver. I have an extra testCompile commented out in the Gradle script but nothing gets fixed if it is commented in.
I think this is a problem in Gradle, or some Gradleized treatment of Maven Central that I don't know much about but is online somewhere. I don't think it is a Kotlin problem. I've used Selenium since it started and am super familiar with it (I've made 100 Maven projects that use Selenium) so I don't think that is it. Of course, I could be wrong with where the root cause is.
Well, this did the trick:
rm -rf ~/.m2/repository/org/seleniumhq/
I didn't know Gradle used the local Maven repo cache. It must have been corrupt somehow.
Hopefully this helps someone another day.
I got this error while building hibernate using gradle
:hibernate-entitymanager:compileTestJava
/home/jsiddharth/workspace/hibernate-orm-master/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/paths/SingularAttributeJoinTest.java:128: error: <anonymous org.hibernate.jpa.test.criteria.paths.SingularAttributeJoinTest$2> is not abstract and does not override abstract method integrate(MetadataImplementor,SessionFactoryImplementor,SessionFactoryServiceRegistry) in Integrator
return new Integrator() {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:hibernate-entitymanager:compileTestJava FAILED
FAILURE: Build failed with an exception.
I assumed that I need to run gradle with the -Xlint options, but turns out, I am doing it wrong. I got this error when I ran
./gradlew eclipse -Xlint:deprecation -Xlint:unchecked Maven settings.xml file did not exist : /home/jsiddharth/.m2/settings.xml
FAILURE: Build failed with an exception.
* What went wrong:
Problem configuring task :eclipse from command line. Unknown command-line option '-X'.
> Unknown command-line option '-X'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.185 secs
How do I run my build to ignore the errors ?
As to you question, the -Xlint is a Java compiler option and has nothing to do with Gradle. You can specify these options via GRADLE_OPTS which is how Gradle passes arguments to the JVM.
Specifically: GRADLE_OPTS="-Xlint:deprecation"
Anyway this is not your trouble. Have a look at the error:
SingularAttributeJoinTest$2> is not abstract and does not override abstract method integrate(MetadataImplementor,SessionFactoryImplementor,SessionFactoryServiceRegistry) in Integrator
return new Integrator() {
You have an anonymous class inside SingularAttributeJoinTest which is declared to implement Integrator but fails to implement method integrate and is not declared abstract. This kind of error can't be suppressed by a -Xlint option of course.