Gradle build throwing error - intellij-idea

I have created a sample gradle project on intellij.
I go to the project root folder and execute the following:
./gradlew installDist
I am getting this error:
FAILURE: Build failed with an exception.
What went wrong:
Task 'installDist' not found in root project 'HelloWorld'.
Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Please please let me know the resolution for this. I have spent one hour on this with no resolution.

If you are going to try a gradle with a sample project, the best way to do it - not to use any IDE at all.
First of all create a directory for your project and make it as a current directory by doing so
mkdir myapp
cd myapp
Then check if gradle is in your PATH by
gradle -v
You should see something like this
Gradle 2.12
Now you are ready to create your first gradle build script. You may do it in vim editor or what ever you want.
vim build.gradle
And just copy and paste following code in your build.gradle file
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.11'
}
So you may try do build the empty project
gradle build
also you may want to add gradle wrapper
gradle wrapper
this command will add gradlw scripts and gradledirectory with wrapper binaries.
So you are ready to add the java code to your project. You should create folders defined in java-project layout
mkdir src
mkdir src/main
mkdir src/main/java
mkdir src/test
mkdir src/test/java
As a result you will get
myapp # project root folder
└── src
├── main
│   └── java       
└── test
└── java
And then just import this project in your IDE.

I had the same problem with springboot application.Then i saw there is no install dir under build.
Then add id 'application' to build.gradle--plugs, it worked well.
This problem shows we dont know gradle no doubt.

Related

dbt: check what packages are installed

Is there a way to check what packages are installed? I would expect something like dbt list packages?
The context is:
Until I run dbt deps the content of packages.yml gives me nothing. And there are some situations when the models could be triggered without running dbt deps
I would like to check the packages in runtime
I searched over google and dbt --help but I didn't find anything.
No, there is no dbt list packages command; there is no --list option for dbt deps; packages are not listed in dbt debug; installed packages are not listed in manifest.json; nor is there another officially supported analog of pip list to determine all of the currently-installed packages in your runtime.
You should open an issue for this!
Your current options (v1.3.0) are:
Run dbt clean and dbt deps before any other dbt command, to ensure your installed dependencies match what is in your packages.yml file
Run dbt compile and inspect manifest.json to ensure it has the macro(s) and/or model(s) you need from a package (note that dbt compile will fail if packages are listed in packages.yml and not instealled)
Inspect your project's dbt_packages subdirectory. Each installed package will have its own directory; if that package has any dependencies, they will be nested under subsequent dbt_packages directories
dbt clean and dbt deps are pretty fast, so the cost of (1) is low, and you don't have to manage the logic/complexity of various bad states if you go that route. But I think you should absolutely open an issue for this!
You should have a packages.yml file in your repo that contains all the packages that are installed via dbt deps.
Following the dbt deps, a directory called /dbt_modules (by default, can be changed in your dbt_project.yml) will appear in your repo (it is included, also by default, in your .gitignore file to avoid duplicating the source code for the package).
Recently I had the opportunity to work with packages closely and I published an article The Practical Guide to Utilizing DBT Packages for Data Transformation which explains dbt packages and its underhood
Here is the quote:
To verify that a package is installed in your dbt project, you can check the packages.yml file and run the dbt deps command.
Check the packages.yml file: This file lists all of the packages that are installed in your dbt project. Look for the name of the package you want to verify. If it is listed in the packages list, then it is installed.
Run the dbt deps command:
This command will show you a list of all of the packages that are installed in your dbt project. Look for the name of the package you want to verify. If it is listed, then it is installed.
In the root dbt project dir, you observe a new dir dbt_modules/ which contains the compiled packages that are ready to be used. NOTE: dir dbt_modules/ has to be added to .gitignore.
>>> tree -L 1 .
.
├── data
├── dbt_modules
├── dbt_project.yml
├── macros
├── models
├── packages
├── packages.yml
├── profiles.yml
├── snapshots
└── target
If your packages.yml file contains package that is not installed then you would not be able to run any dbt command:
>>> dbt list
Encountered an error:
Compilation Error
dbt found 1 package(s) specified in packages.yml, but only 0 package(s) installed in dbt_modules. Run dbt deps to install package dependencies.
So this is our guarantee that in runtime we would not have any issues related to the package installation.

RxKotlin repo gradle build compilation fails with gradle 4.7 (JDK 1.8)

I tried the following:
$ git clone https://github.com/ReactiveX/RxKotlin.git
$ cd RxKotlin/
$ gradle build
It fails with:
...FAILURE: Build failed with an exception.
Where: Build file '/home/myuser/RxKotlin/build.gradle' line: 13
What went wrong: A problem occurred evaluating root project 'rxkotlin'.
org/gradle/api/internal/project/AbstractProject
Looks like I have to use the gradle 2.14 version that came as part of the repo instead of the one I have installed locally. It builds successfully now

react-native - unable to run sample app

Following the tutorial here, I am unable to run the app in the emulator. When I execute the react-native run-android command from the DOS prompt, here is the error I get:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.3.
Required by:
:AwesomeProject:unspecified
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://repo1.maven.org/maven2/com/android/to
ols/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/2.2.3/gradle-2.2.3.pom'.
> repo1.maven.org
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/2.2.3/gradle-2.2.3.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Things I tried:
Editing build.gradle file and changing classpath from classpath 'com.android.tools.build:gradle:2.2.3' to com.android.tools.build:gradle:3.3.0' (the version I have installed with Android Studio).
Verified that jcenter() is listed as a repository in build.gradle under both buildscript and allprojects
Try setting it to 2.3.0
Strange, I can't see any 2.2.3 in that path but I can see a 2.3.0
http://repo1.maven.org/maven2/com/android/tools/build/gradle/
I recreated the project using the react-native cli, and the issue seemed to correct itself. I should note that I believe I had not installed android studio when I initially created the project, so maybe that had something to do with it, not sure.

Android build error: Cannot evaluate module RCTVideo : Configuration with name 'default' not found

I'm trying to get set up using https://github.com/brentvatne/react-native-video for an android version of a react-native app. After making all the changes to the various gradle files I'm running into this issue below.
I'm a bit of a novice with Android development, and I think I'm just making a silly mistake which is why I'm asking the question here rather than raising an issue. Any advice would be appreciated!
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module RCTVideo : Configuration with name 'default' not found.
* 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: 0.851 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Edit, settings.gradle looks like this:
rootProject.name = 'app_name'
include ':RCTVideo', ':app'
project(':RCTVideo').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
Without seeing the Settings.gradle my guess would be that the project location isn't going into the folder that has the gradle for the android version of the library. I would recommend added /android at the end of the path if it isn't there already.
I will update this answer when the Settings.gradle is provided.
-- Edit after additional information provided --
The version available on NPM is from 3 months ago. It looks like they didn't start adding Android support till Oct 30th and have continued working on it. As such you likely don't actually have the Android code in your node_modules folder. You can either wait till they push an update to NPM or install directly from the git repo. If you go the route of installing directly from the git repo you might want to tag it with a specific commit so you don't keep getting the latest every time you do a npm install.

Do we have to install/deploy parent maven module to use submodule?

lets say we have a ParentPom.xml and there are sub child modules under it; subModule-A and subModule-B. I want to use subModule-A.jar in an another project. If i run "mvn install" command only in subModule-A directory i can install it into my M2 repository but after i define dependency to it from my other project it says something "no parent found for subModule-A". It is OK if i run install command for ParentPom.xml.
Any idea about this problem?
Thx...
You need to install / deploy all modules that are referenced by submodule-A, including the parent.
You can do it like this:
mvn deploy -pl submodule-a -am
Which translates to
deploy module submodule (-pl submodule-a)
and all of it's dependencies in the current reactor project (-am)
Call mvn -help to see all possible command line options