Setting Environment Variables using Gradle with IntelliJ IDEA - spring-boot

In my Spring Boot project I have Environment Variables using a File:
When I select "Build and run using: " Gradle, IntelliJ doesn't take the environment variables value.
Caused by: java.lang.IllegalArgumentException: Not enough variable values available to expand 'SPRING_PROFILES_ACTIVE'
at org.springframework.web.util.UriComponents$VarArgsTemplateVariables.getValue(UriComponents.java:370)
at org.springframework.web.util.UriComponents.expandUriComponent(UriComponents.java:263)
at org.springframework.web.util.HierarchicalUriComponents$FullPathComponent.expand(HierarchicalUriComponents.java:923)
at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:440)
at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:53)
at org.springframework.web.util.UriComponents.expand(UriComponents.java:172)
at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:517)
at org.springframework.web.util.DefaultUriBuilderFactory.expand(DefaultUriBuilderFactory.java:154)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:716)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:340)
at org.springframework.vault.core.VaultTemplate.lambda$doRead$5(VaultTemplate.java:461)
at org.springframework.vault.core.VaultTemplate.doWithSession(VaultTemplate.java:448)
at org.springframework.vault.core.VaultTemplate.doRead(VaultTemplate.java:458)
at org.springframework.vault.core.VaultTemplate.read(VaultTemplate.java:353)
at org.springframework.vault.core.lease.SecretLeaseContainer.doGetSecrets(SecretLeaseContainer.java:645)
at org.springframework.vault.core.lease.SecretLeaseContainer.doStart(SecretLeaseContainer.java:390)
at org.springframework.vault.core.lease.SecretLeaseContainer.start(SecretLeaseContainer.java:380)
at org.springframework.vault.core.lease.SecretLeaseContainer.addRequestedSecret(SecretLeaseContainer.java:343)
at org.springframework.vault.core.env.LeaseAwareVaultPropertySource.loadProperties(LeaseAwareVaultPropertySource.java:176)
at org.springframework.vault.core.env.LeaseAwareVaultPropertySource.<init>(LeaseAwareVaultPropertySource.java:161)
at org.springframework.vault.core.env.LeaseAwareVaultPropertySource.<init>(LeaseAwareVaultPropertySource.java:119)
at org.springframework.cloud.vault.config.VaultConfigDataLoader.createLeasingPropertySource(VaultConfigDataLoader.java:287)
at org.springframework.cloud.vault.config.VaultConfigDataLoader.createLeasingPropertySourceFailFast(VaultConfigDataLoader.java:310)
... 28 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not enough variable values available to expand 'SPRING_PROFILES_ACTIVE'
Execution failed for task ':app:MyApplication.main()'.
> Process 'command '/usr/local/java/jdk-11.0.16.1.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* 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.
When I select "Build and run using: " IntelliJ IDEA runs without problem!
How to pass environment Variables value?

Related

Data-Binding fails with "couldn't make a guess" ANDROID

Cause: couldn't make a guess for
Task :app:dataBindingGenBaseClassesDebug FAILED
Execution failed for task ':app:dataBindingGenBaseClassesDebug'.
couldn't make a guess for
Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
This is because of XML file Error maintained below ,
Check your variable attribute in layout tag it must not contain null
value.
Check your variable attribute in layout tag your package name must not
start with capital alphabet and Class name must not start with small alphabet.Problem Screenshot

How to fix a diagnostic error in flutter?

When I run the application gradle is failing to build
Compiler message:
file:///C:/Users/Wellick/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sticky_header-0.3.4/lib/src/widgets/sticky_header_layout_builder.dart:147:16:
Error: The argument type 'String' can't be assigned to the parameter
type 'DiagnosticsNode'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart'
('file:///C:/Users/Wellick/Documents/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to
'DiagnosticsNode'.
context: context);
^ Compiler failed on C:\Users\Wellick\Desktop\flutter\rapidinho-master\lib\main.dart
FAILURE: Build failed with an exception.
Where: Script 'C:\Users\Wellick\Documents\flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 665
What went wrong: Execution failed for task ':app:compileflutterBuildDebugArm'.
Process 'command 'C:\Users\Wellick\Documents\flutter\bin\flutter.bat'' finished with
non-zero exit value 1
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 24s Finished with error: Gradle task assembleDebug
failed with exit code 1
It seems that this issue was due to the previous version 0.3.4 to be exact, the issue was reported in GitHub and the fix is to upgrade the version to 0.4.0. Currently, the latest version 0.5.0 is more stable than the previous versions.

Single quote in double quote test name of Spock test leads to 'unexpected token', BUT only when run with gradle and as isolated test

I just installed intellij and downloaded the geb-example-grade (https://github.com/geb/geb-example-gradle). In Intellij settings I configured under gradle/runner: Run test using: Let me choose per test. Then I ran the test "can get to the current Book of Geb" with gradle and it worked fine also running the GebishOrgSpec class worked fine. Then I added a single quote to the methodname of the test, i.e. "can ' get to the current Book of Geb". Running the GebishOrgSpec class (containing that test) with gradle still works fine. But when I run the test with gradle (i.e. after Alt-Shift-F10 in the run menu I choose "GebishOrgSpec.can ' get to the current Book of Geb" instaead of "GebishOrgSpec") i get the following error:
FAILURE: Build failed with an exception.
* Where:
Initialization script '/tmp/ijtestinit3.gradle' line: 6
* What went wrong:
Could not compile initialization script '/tmp/ijtestinit3.gradle'.
> startup failed:
initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get # line 6, column 49.
ludes = ['GebishOrgSpec.can ' get to the
^
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 0s
Cause: startup failed:
initialization script '/tmp/ijtestinit3.gradle': 6: unexpected token: get # line 6, column 49.
ludes = ['GebishOrgSpec.can ' get to the
^
1 error
I also tried run running the test with Junit (after setting the driver path) that also works fine. For me it makes absolutely no sense that the very same test works when running the class but not when running the method of the class. Here just to be complete also the class code:
import geb.spock.GebSpec
class GebishOrgSpec extends GebSpec {
def "can ' get to the current Book of Geb"() {
when:
to GebishOrgHomePage
and:
manualsMenu.open()
then:
manualsMenu.links[0].text().startsWith("current")
when:
manualsMenu.links[0].click()
then:
at TheBookOfGebPage
}
}
Update: I had this behaviour on two different computers, but i would appreciate if others also test this. It should be fairly easy to reproduce (if there are questions on the description above, let me know.) Maybe u won't have the error and i have some bad configurations or u can confirm this bug and we raise the attention for it.

phongap's error:- Execution failed for task ':transformClassesWithDexForDebug'

when i am trying to build my phonegap app at that time i am getting this error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;
* 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: 3.261 secs
is there anything missing? what is wrong? thanks in advance
below, solution works for me.
i checked the 'project.properties' file in android's folder.
target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-maps:+
cordova.system.library.2=com.google.android.gms:play-services-location:+
cordova.gradle.include.1=phonegap-plugin-push/app-push.gradle
cordova.system.library.3=com.android.support:support-v13:23+
cordova.system.library.4=com.google.android.gms:play-services-gcm:10.2+
cordova.system.library.5=me.leolin:ShortcutBadger:1.1.14#aar
cordova.gradle.include.2=card.io.cordova.mobilesdk/app-build.gradle
cordova.gradle.include.3=com.paypal.cordova.mobilesdk/app-build.gradle
cordova.system.library.6=com.google.android.gms:play-services- location:10.2+
cordova.system.library.7=com.razorpay:checkout:1.3.0
cordova.system.library.8=com.android.support:support-v4:25.+
cordova.system.library.9=com.android.support:appcompat-v7:25.+
cordova.system.library.10=com.google.android.gms:play-services-maps:+
cordova.system.library.11=com.google.android.gms:play-services-location:+
i just removed last two lines because those lines seems duplicated. and it works for me

Scaladocs build fails kafka

I am trying to build Apache kafka from source as explained here using gradle but I am not able to get scaladocs to build. Following is the error log for same:
== Expanded type of tree ==
ConstantType(value = Constant(kafka.utils.timer.TimerTaskList))
uncaught exception during compilation: java.io.IOException
File name too long
two errors found
:core:compileScala FAILED
:core:compileScala (Thread[Daemon worker,5,main]) completed. Took 1 mins 4.416 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':core:compileScala'.
> Compilation failed
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 13.736 secs
Stopped 1 compiler daemon(s).
Received result
CommandFailure[value=org.gradle.launcher.exec.ReportedException:org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':core:compileScala'.] from daemon DaemonInfo{pid=5656, address=[4d0d3e79-f94a-43ca-b183-792d2bfe1a95 port:55666, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=1f1f4b55-9da9-4283-b361-8b0bfce3f208,javaHome=/usr/lib/jvm/java-7-oracle,daemonRegistryDir=/home/akshat/.gradle/daemon,pid=5656,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IN,-Duser.language=en,-Duser.variant]}.
Though I suspect it is a memory issue but I do not see any place of altering it. I tried editing here:
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
jvmArgs = ['-XX:MaxPermSize=512m']
}
}
}
But it did not help.
Yes this is probably related to Gradle memory settings. You can increase the Gradle heap by setting the environment variable: set GRADLE_OPTS=-Xmx1024m (Windows) and it might work better.
The error was caused due to my home folder being encrypted. It seems that kafka has trouble installing in encrypted folders. I had to reinstall ubuntu to solve this. There is no other alternative.

Resources