Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-10661

Java quickstart using Gradle doesn't work

Details

    Description

      As written, the Java quickstart using Gradle doesn't work.  The issue is that the execute task created in step 2 makes it so that the exec.args define is required for every task (including build!), otherwise a NullPointerException is thrown.

       

      Example output:

       

      ~/word-count-beam$ gradle build
      
      
      FAILURE: Build failed with an exception.
      
      
      * Where:
      Build file '/Users/username/word-count-beam/build.gradle' line: 56
      
      
      * What went wrong:
      A problem occurred evaluating root project 'word-count-beam'.
      > java.lang.NullPointerException (no error message)
      
      
      * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
      
      
      * Get more help at https://help.gradle.org
      
      
      BUILD FAILED in 582ms
      

       

      Where line 56 of my build.gradle file is the split command in the execute task:

          52	task execute (type:JavaExec) {
          53	        main = System.getProperty("mainClass")
          54	        classpath = sourceSets.main.runtimeClasspath
          55	        systemProperties System.getProperties()
          56	        args System.getProperty("exec.args").split()
          57	}
      

       

      Running with an empty exec.args fixes the issue:

      ~/word-count-beam$ gradle build -Dexec.args=""
      
      
      Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
      Use '--warning-mode all' to show the individual deprecation warnings.
      See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings
      
      
      BUILD SUCCESSFUL in 782ms
      4 actionable tasks: 4 up-to-date
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mtruscello Marcus Truscello
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h