Skip to content

Maven Plugin for running and downloading jbang

License

Notifications You must be signed in to change notification settings

jbangdev/jbang-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JBang Maven Plugin

GitHub Workflow Status Maven Central

The JBang Maven plugin allows JBang scripts to be executed during a Maven build.

The plugin attempts to use an existing JBang installation. If no JBang installation is found, the plugin will install JBang by downloading and caching the latest version binaries (by default in your Maven project directory) for subsequent runs.

Arguments

  • script: The script to be executed by JBang

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <script>hello.java</script>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • args : The arguments to be used in the JBang script (if any)

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <script>hello.java</script>
                <args>
                  <arg>--option1=foo</arg>
                </args>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • trusts: If the script resides in a remote location, this parameter specifies what URLs should be trusted. See URLs from Trusted Sources for more information

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <script>https://github.com/jbangdev/jbang-examples/blob/master/examples/lang.java</script>
                <trusts>
                  <trust>https://github.com</trust>
                </trusts>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • jbangargs: Arguments for jbang (not the script)

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <jbangargs>
                     <jbangarg>--quiet</jbangarg>
                </jbangargs>
                <script>hello.java</script>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • jbangVersion: If your envronment lacks the JBang binaries in the PATH, you can specify the JBang version to be installed. If not specified, the plugin will resolve to the latest JBang release available

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <script>hello.java</script>
                <jbangVersion>0.47.1</jbangVersion>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • jbangInstallDir: Alternative location of JBang installation. The default value is ${project.basedir}

Example

      <plugin>
        <groupId>dev.jbang</groupId>
        <artifactId>jbang-maven-plugin</artifactId>
        <version>0.0.7</version>
        <executions>
          <execution>
            <id>run</id>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                <script>hello.java</script>
                <jbangInstallDir>${project.build.directory}</jbangInstallDir>
            </configuration>
          </execution>
        </executions>
      </plugin>

Reporting bugs/issues/features

Please use https://github.com/jbangdev/jbang for reporting bugs/issues/features.

Releasing

To release a new version of the plugin, run the following command:

mvn versions:set -DnewVersion=0.0.Z
git commit -a -m "release 0.0.Z"
git tag -a 0.0.Z -m "release 0.0.Z"
git push

When completed correctly, the new version will be available in Maven Central within some time (usually less than 30 minutes).

To prepare for the next development iteration, run the following command:

shell mvn versions:set -DnewVersion=0.0.Z+1-SNAPSHOT git commit -a -m "prepare for next development iteration" git push