Saturday 7 April 2018

Java Common project task

Common tasks

The following are task conventions applied by built-in and most major Gradle plugins.

Computing all outputs

It is common in Gradle builds for the build task to designate assembling all outputs and running all checks.
❯ gradle build

Running applications

It is common for applications to be run with the run task, which assembles the application and executes some script or binary.
❯ gradle run

Running all checks

It is common for all verification tasks, including tests and linting, to be executed using the check task.
❯ gradle check

Cleaning outputs

You can delete the contents of the build directory using the clean task, though doing so will cause pre-computed outputs to be lost, causing significant additional build time for the subsequent task execution.
❯ gradle clean

Project reporting

Gradle provides several built-in tasks which show particular details of your build. This can be useful for understanding the structure and dependencies of your build, and for debugging problems.
You can get basic help about available reporting options using gradle help.

Listing projects

Running gradle projects gives you a list of the sub-projects of the selected project, displayed in a hierarchy.
❯ gradle projects
You also get a project report within build scans. Learn more about creating build scans.

Listing tasks

Running gradle tasks gives you a list of the main tasks of the selected project. This report shows the default tasks for the project, if any, and a description for each task.
❯ gradle tasks
By default, this report shows only those tasks which have been assigned to a task group. You can obtain more information in the task listing using the --all option.
❯ gradle tasks --all

Show task usage details

Running gradle help --task someTask gives you detailed information about a specific task.
Example: Obtaining detailed help for tasks
Output of gradle -q help --task libs
> gradle -q help --task libs
Detailed task information for libs

Paths
     :api:libs
     :webapp:libs

Type
     Task (org.gradle.api.Task)

Description
     Builds the JAR

Group
     build
This information includes the full task path, the task type, possible command line options and the description of the given task.

Reporting dependencies

Build scans give a full, visual report of what dependencies exist on which configurations, transitive dependencies, and dependency version selection.
❯ gradle myTask --scan
This will give you a link to a web-based report, where you can find dependency information like this.
Build Scan dependencies report
Learn more in Inspecting Dependencies.

Listing project dependencies

Running gradle dependencies gives you a list of the dependencies of the selected project, broken down by configuration. For each configuration, the direct and transitive dependencies of that configuration are shown in a tree. Below is an example of this report:
❯ gradle dependencies
Concrete examples of build scripts and output available in the Inspecting Dependencies.
Running gradle buildEnvironment visualises the buildscript dependencies of the selected project, similarly to how gradle dependencies visualizes the dependencies of the software being built.
❯ gradle buildEnvironment
Running gradle dependencyInsight gives you an insight into a particular dependency (or dependencies) that match specified input.
❯ gradle dependencyInsight
Since a dependency report can get large, it can be useful to restrict the report to a particular configuration. This is achieved with the optional --configuration parameter:

Listing project properties

Running gradle properties gives you a list of the properties of the selected project.
Example: Information about properties
Output of gradle -q api:properties
> gradle -q api:properties

------------------------------------------------------------
Project :api - The shared API for the application
------------------------------------------------------------

allprojects: [project ':api']
ant: org.gradle.api.internal.project.DefaultAntBuilder@12345
antBuilderFactory: org.gradle.api.internal.project.DefaultAntBuilderFactory@12345
artifacts: org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler_Decorated@12345
asDynamicObject: DynamicObject for project ':api'
baseClassLoaderScope: org.gradle.api.internal.initialization.DefaultClassLoaderScope@12345
buildDir: /home/user/gradle/samples/userguide/tutorial/projectReports/api/build
buildFile: /home/user/gradle/samples/userguide/tutorial/projectReports/api/build.gradle

Software Model reports

You can get a hierarchical view of elements for software model projects using the model task:
❯ gradle model
Learn more about the model report in the software model documentation.
Session attribute of JSP page directive with example. buffer attribute in JSP page directive with example. autoFlush attribute in JSP page directive with example. contentType attribute in JSP page directive with example. isErrorPage and errorPage attribute in JSP page directive isThreadSafe attribute in JSP page directive with example. language attribute in JSP page directive with example. info attribute in JSP page directive with example. JSP include directive with example. JSP taglib directive with example. JSP implicit objects with example. JSP out implicit object with example. JSP request implicit Object with example. JSP response implicit object with example. JSP config implicit object with example. JSP application implicit object with example. JSP session implicit object with example. JSP pageContext implicit object with example. JSP page implicit object with example. JSP exception implicit object with example. JSP action tags with example. jsp:forward action tag with example. jsp:include action tag with example. jsp:param action tag with example. jsp:useBean, jsp:setProperty and jsp:getProperty action tag. Exception handling in JSP with example. JSP Expression Language with example. JSTL (JSP Standard Tag Library) with example. JSTL Core Tags with example. JSTL c:out Core Tag with example. JSTL c:set Core Tag with example. JSTL c:remove Core Tag with example. JSTL c:catch Core Tag with example. JSTL c:if Core Tag with example. JSTL c:choose , c:when and c:otherwise Core Tags with example. JSTL c:import Core Tag with example. JSTL c:forEach Core Tag with example. JSTL c:forTokens Core Tag with example. JSTL c:url Core Tag with example. JSTL c:param Core Tag with example. JSTL c:redirect Core Tag with example. JSTL Formatting Tags with example. JSTL fmt:formatNumber Formatting Tag with example. JSTL fmt:parseNumber Formatting Tag with example. JSTL fmt:formatDate Formatting Tag with example. JSTL fmt:parseDate Formatting Tag with example. JSTL fmt:bundle Formatting Tag with example. JSTL fmt:setBundle Formatting Tag with example. JSTL fmt:setLocale Formatting Tag with example. JSTL fmt:timeZone Formatting Tag with example. JSTL fmt:setTimeZone Formatting Tag with example. JSTL fmt:requestEncoding Formatting Tag with example. JSTL Functions with example. JSTL fn:contains() function with example. JSTL fn:containsIgnoreCase() function with example. JSTL fn:startsWith() function with example. JSTL fn:endsWith() function with example. JSTL fn:escapeXml() function with example. JSTL fn:indexOf() function with example. JSTL fn:join() and fn:split() function with example. JSTL fn:length() function with example. JSTL fn:replace() function with example. JSTL fn:subString() function with example. JSTL fn:subStringAfter() function with example. JSTL fn:subStringBefore() function with example. JSTL fn:toLowerCase() function with example. JSTL fn:toUpperCase() function with example. JSTL fn:trim() function with example. Steps to create Custom tags with body in jsp with example. Custom tag with attributes. JSP Interview Questions and Answers. Struts 2 overview. Struts 2 Architecture. Struts 2 Configuration Files. Action in struts 2. Action in struts 2 by using POJO class with example. Action in struts 2 by implementing Action interface with example. Action in struts 2 by extending ActionSupport class with example. Struts 2 Hello World example. Multiple configuration file in Struts 2 with example. OGNL in struts 2 with example. Value Stack in struts 2 with example. Interceptors in struts 2 with example. Struts 2 execAndWait interceptor with example. Struts 2 custom interceptor with example. Struts 2 result type with example. Struts 2 Redirect result type with example. Struts 2 validation framework with example. Struts 2 validation by built-in validators with example. Struts 2 required validator with example. Struts 2 requiredstring validator with example. Struts 2 stringlength validator with example. Struts 2 int validator with example. Struts 2 double validator with example. Struts 2 date validator with example. Struts 2 email validator with example. Struts 2 regex validator with example. Struts 2 url validator with example. Struts 2 i18n with example. Struts 2 Zero Configuration by convention approach.

No comments:

Post a Comment