Why Dagger doesn't generate Dagger Component? - dagger

Here is the error My dependencies plugins Module Component

Everthing is looking good, but you have to create DaggerAppComponent by building project using gradle build and then use it get dependencies.
AppComponent mAppComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.netModule(new NetModule("https://api.github.com"))
.build();

Related

Swagger API documentation in Play application with Gradle

I'm developing a Play application in Scala as a hobby project. I'm using Gradle as a building tool.
I want to generate API documentation using swagger. My goal is to generate swagger.json file containing my REST API documentation in JSON format with Gradle task during build of the project.
To generate the swagger file I'm using swagger-gradle-plugin. I have annotated controllers and methods in the controllers with proper annotations from swagger.io.swagger_play library.
Unfortunately, play annotations are not recognized by the plugin. File swagger.json generated using Gradle resolve task only picks up JAX-RS annotations I put in the controllers when trying to make plugin work.
For example, when I annotated a controller with
#Api(value="testController", tags = Array("Test controller")
annotation, the resolve task produced empty swagger.json file.
When I annotated the controller with JAX-RS annotation
#Path("/")
and then added JAX-RS annotations to the method inside the controller
#GET
#Path("testEndPoint1")
resolve task generated documentation for /testEndPoints1. But annotations from swagger.io.swagger_play are still ignored so there is not much information in the generated documentation.
I saw there are some plugins for sbt, but I want to make it work using Gradle.
Is there any way I can generate swagger REST API documentation in Play application while using Gradle building tool?
Versions of the tools in the project:
Play 2.8
Gradle 6.5.1
Scala 2.12
io.swagger.core.v3.swagger-gradle-plugin 2.1.6
io.swagger:swagger.play_2.12:1.7.1
EDIT:
Gradle configuration of the plugin:
resolve {
outputFileName = "swagger"
outputDir = "build/swagger_doc"
classpath = sourceSets.main.runtimeClasspath
readAllResources = true
openApiFile = file("openapi_config.yaml")
}

How to get list of all JARs dependent by a Gradle app project?

Given a Java or Scala application built using Gradle and dependencies defined by Gradle, is it possible to create a task that simply generates a list of all JARs (with versions in file name) that are dependent by the app and required to run the application?
add 'project-report' plugin will add tasks for dependency report generation html/txt
https://docs.gradle.org/current/userguide/project_report_plugin.html

Gradle other project as dependency in eclipse

I have a web application which depends on another standalone project. Simply the web project requires a standalone project jar to be in classpath. I have built the standalone project jar with gradle and included that in web application's WEB-INF/lib folder. The project is running as expected. Now i want to make it automatic by adding that project as dependency. This is also achieved using the following code.
settings.gralde
include 'job-invoker'
project(':job-invoker').projectDir = new File(settingsDir, '../job-invoker')
build.gradle
dependencies {
compile project(':job-invoker')
.
.
}
I'm able to build the war file from command line using gradle and run it in tomcat. But i'm getting errors in eclipse. I'm not able to run the project in eclipse due to the compilation errors. Can some one please help me. Thanks in advance.
Finally i found a solution for this by installing the other project in maven local repository and adding this as a regular dependency in project. Reference code is given below.
Other project Gradle file
apply plugin: 'maven'
group = 'com.xxx.job'
version = '1.0'
Run gradle install command on this project. Then add mavenLocal() to your repositories in another project and add the dependency
compile 'com.xxx.job:job-invoker:1.0'

importing dependencies into eclipse using gradle

I've got what appears to be an adequate gradle file but eclipse refuses to recognise the dependancy I'm trying to import (despite refreshing the gradle project after implementing the dependancy)
My gradle file lacks a buildscript{} block but I'm not familar enough with gradle to implement it. My build file was autogenerated by eclipse so I don't see why it'd be an issue.
I'm trying to import "com.intrinio:sdk:0.0.1"
build.gradle:
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
compile "com.intrinio:sdk:0.0.1"
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:21.0'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
I think this is the lib you want to use.
As it's not deployed in a public repository, you have to manually install it. Checkout the project from github and do as below :
Installation
To install the Intrinio Java SDK to your local Maven repository, simply execute:
mvn install
Then, in your gradle file, add mavenLocal() in the repository section and it should just work fine.

Add scalacheck dependency to gradle project

I am trying to use scalaCheck (https://github.com/rickynils/scalacheck) to a gradle project. However, adding it this way:
dependencies {
...
compile group: 'org.scalacheck', name: 'scalacheck_2.11', version: '1.12.5'
...
}
doesn't seem to be doing the trick. I also tried to add it in a maven project. In both cases, trying to do the following
import org.scalacheck.Prop.forAll
reports the error
object scalacheck is not a member of package org
I ran "gradle dependencies" before trying to import it, and it seemed to download everything just fine, finishing the command without throwing errors. Is there a way to add scalacheck to my project and if so, how?
Note: not sure if relevant, but I am using Eclipse Neon with all the scala plugins.
(So it seems the problem was with using the eclipse gradle integration.) You have to manually update the project by using the Gradle | Refresh Gradle Project from the project's context menu on each dependency change (though it might be useful to do that on each change to gradle configuration files).