score:3
Accepted answer
The 'build' task in Gradle is commonly mistaken for a task that builds all tasks in a project. The 'build' task is actually provided by the java-base plugin and includes the following tasks:
compileJava, processResources, classes, jar, assemble, compileTestJava, processTestResources, testClasses, test, and check
Instead of running 'gradle build' I recommend the use of defaultsTasks
`defaultTasks 'build', 'shadowJar'`
Putting that line in your build.gradle will allow Gradle to be invoked without arguments such that both build and shadowJar are both run.
> gradle
I am not familiar with the shadowJar plugin, but if it exposes a task named shadowJar, the use of a dependsOn line in build.gradle could simplify the defaultTasks line.
project.tasks.shadowJar.dependsOn build
simplifies the defaultTasks line to
defaultTasks 'shadowJar'
Source: stackoverflow.com
Related Query
- shadow plugin in gradle is not working - gradle build does not build a fat jar
- Why does sbt build fail with "MissingRequirementError: object scala.runtime in compiler mirror not found."?
- Intellij: SBT-based Scala project does not build with Java 9
- Scala sbt assembly jar does not work (class implementation not found) but code works when through IntelliJ
- Could not build the program from JAR file
- Adding an SBT plugin which does not specify an SBT version in its URL
- scala maven plugin not packaging scala files into jar
- Idea 13 and Gradle when trying to use scala-compiler in the Scala facets does not find scala-library
- Why does the gradle commandline do not show specs2 results?
- Does Spark Filter/Predicate Pushdown not working as intended in ORC file?
- jar does not generate correct manifest file
- Scala project does not automatically build in Eclipse
- Scala: Could not find main class when running fat jar
- Getting a jar does not exist and java.lang.ClassNotFoundException while running a simple twitter sentiment analysis code
- IntelliJ Build does not execute sbt 'compile' dependencies
- Maven: build Scala code and Java code together into a Fat JAR
- Build Executable Jar with Gradle for Gatling
- Why does running exported jar file give "Exception in thread "main" java.io.IOException; Class not found"?
- Swagger does not working well with Play Framework 2
- Sbt helloworld example build is not working
- How to build a fat jar for running a spark job on EMR?
- Running a jar produce from gradle build
- scala play unmanaged jar added but import not working
- Why does this list matcher not working as expected?
- sc.TextFile("") working in Eclipse but not in a JAR
- Build Jar with dependencies including multiple main classes using Gradle in IntelliJ
- Delta Table Insert not Working Correctly, Read Errors out with - org.apache.spark.sql.AnalysisException: Table does not support reads
- sbt-jacoco plugin does not work with Java11 and throws instrumenting class error
- Packaging scala code into a jar file with proguard not working
- Sql Update command used in play framework (scala) does not seem to be working
More Query from same tag
- Scala method not being invoked
- scala-breeze/spark replace a row of a densematrix with another densevector
- How to reuse expression in withColumn
- Prevent delimiter collision while reading csv in Spark
- How to take specific value from key in JSON in Scala?
- Create an ExecutorService from an Executor
- Spray: Marshalling UUID to JSON
- Can I use a third party scala library in java?
- Passing a singleton as argument in Scala
- Aggregating multiple errors
- Scala --- Error when use "[" "]" in parser
- Zipping two lists into a single list of objects rather than a list of tuples?
- Getting data from Array[String] in RDD using Scala
- Spark running Liblinear unable to load JBLAS jar
- When does Scala force a stream value?
- How to convert sbt 0.12 "<<= map case" to sbt 1.x
- Defining Tuple types
- Why doesn't tail recursion results in better performance in this code?
- custom signup "signupXhtml"
- Multiplying two columns from different data frames in spark
- How to disable HTTP requests on Heroku and/or auto-redirect to HTTPS?
- Surround failing higher order function with try catch?
- Using scala generics and manifest to cast within a class
- Convert spark dataframe map column to json
- How do you compose tasks in sbt?
- Scala. Arguments of nested lambdas with short syntax
- Scala : Match particular word and count frequency
- How to determine size of the data while reading a table using spark?
- Enforce a "at least one of two fields should be present" rule in Circe
- Cannot resolve reference StructField with such signature