- Build without executing tests:
./gradlew build -x test
- Install jars into local repo:
- Install:
./gradlew install
- Where to locate the new jars: Example
~/.m2/repository/io/pravega/pravega-client
- Install:
- Generate a distribution:
./gradlew distribution -x test
./gradlew clean javadocs
- Running checkstyle for tests of standalone module: ````
- Examples of common Gradle tasks
Tasks | Standalone | Controller |
---|---|---|
Checkstyle | For src/main: ./gradlew :standalone:checkstyleMain , for src/test ./gradlew :standalone:checkstyleTest |
./gradlew :controller:checkstyleMain ./gradlew :controller:checkstyleTest |
Compile | ./gradlew :standalone:compileJava |
./gradlew :controller:compileJava |
Tests | ./gradlew :standalone:test |
./gradlew :controller:test |
Builds | ./gradlew :standalone:build |
./gradlew :controller:build |
Spotbugs | ./gradlew :standalone:spotbugsMain ./gradlew :standalone:spotbugsTest |
./gradlew :controller:spotbugsMain ./gradlew :controller:spotbugsTest |
- Running a specific test in a module:
./gradlew :module:tas; --tests "nameoftest"
Example:
./gradlew :controller:test --tests "io.pravega.controller.server.rpc.auth.PravegaAuthManagerTest"
- Local repo:
- Gradle:
~/.gradle/caches/modules-2/files-2.1
- Maven:
~/.m2/repository/
- Gradle:
Steps:
- Generate the distribution (skipping tests to save time):
gradlew distribution -x test
. - Copy config files from
pravega/config
intopravega/standalone/build/install/pravega-standalone/conf
. - Update any configuration as desired under the conf folder.
- Start standalone by running the
pravega/standalone/build/install/pravega-standalone/bin/pravega-standalone.bat
file.
Dependency tree for all projects
- Checking dependencies of a specific project:
./gradlew <project>:dependencies
for example: ``./gradlew :controller:dependencies``
*./gradle allDeps
Generating an HTML report (multiproject):
-
Add
apply plugin: 'project-report'
to allProjects- Add the following to allProjects
htmlDependencyReport { projects = project.allprojects }
- Execute
gradlew htmlDependencyReport
- See the reports at
pravega\build\reports\project
- Add the following to allProjects
-
Further reading:
-
See additional ways here.
OWASP Dependency Checker: (Read more about it here.)
- Add the following highlighted lines:
buildscript { .... dependencies { ... classpath 'org.owasp:dependency-check-gradle:4.0.2' // add this line... } } apply plugin: 'org.owasp.dependencycheck' // ... and this one
- Now, execute
./gradlew dependencyCheckAggregate
. - Look for the output at build/reports/dependency-check-report.html
Add the following to the task (say, to startStandalone task):
def fileNameTime = (new SimpleDateFormat("ssmmHH_yyyyMMdd")).format(new Date())
doFirst {
standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
new FileOutputStream("$projectDir/../consoleLogs/${fileNameTime}.out"), System.out);
}
If you don't want to use released versions, you can use the Pravega JFrog repository.
systemProperties 'singlenode.configurationFile' : new File("$projectDir/../config/standalone-config.properties").absolutePath
Purpose | Maven | Gradle |
---|---|---|
Find the version | mvn --version |
gradle --version |
To create JAR/WAR/EAR | mvn package |
gradle assemble |
To run unit tests | mvn test |
gradle test |
To skip unit tests | mvn install -DskipTests or mvn install -Dmaven.test.skip=true |
gradle -x test install |
To run JUnits and create JAR/WAR/EAR. To compile, tests and assemble. | mvn test package |
gradle build |
To clean (delete build directory) | mvn clean |
gradle clean |
To Install, i.e. to compile, build and install to local maven repository | mvn install |
gradle install |
To deploy application WAR/EAR file into server | mvn deploy or to run on Jetty embedded server mvn jetty:run |
gradle jettyRun . See more options here |