![getting java jar file to work getting java jar file to work](https://www.eviltester.com/images/javafortesters/faqs/add_jar_to_ide_library_2.png)
It is good practice to use the name of the source file that is the main entry point of theĪpplication (minus the extension). java fileĭeps =, # rule that generates that fileĪ unique name for this target.
#Getting java jar file to work code
The following code snippet illustrates a common mistake: These will match the classes in theĭeploy.jar except where jars have no matching source jar.Ī deps attribute is not allowed in a java_binary rule without
#Getting java jar file to work archive
![getting java jar file to work getting java jar file to work](https://www.repairwin.com/wp-content/uploads/2020/12/image-18.png)
This will contain the launcher plus any native (C++) dependencies of These are automatically loadedĪttribute, then instead of being a normal JAR file, the _deploy.jar will be a It alsoĬontains the native libraries needed for dependencies. Searched the classpath from the binary's wrapper script from beginning to end. The deploy jar contains all the classes that would be found by a classloader that Using the wrapper script is preferred to java -jar because itĪlso passes the JVM flags and the options Java -jar command or with the wrapper script's -singlejar name_deploy.jar: A Java archive suitable for deployment (onlyīuilding the _deploy.jar target for your ruleĬreates a self-contained jar file with a manifest that allows it to be run with the.name-src.jar: An archive containing the sources ("source.Resources corresponding to the binary's direct dependencies. name.jar: A Java archive, containing the class files and other.src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txtįor a list of configurable flags and environment variables accepted by the wrapper.
![getting java jar file to work getting java jar file to work](https://thebreakdown.xyz/wp-content/uploads/2018/08/Download-The-Java-JDK.png)
The wrapper script accepts several unique flags. The wrapper shell script uses a classpath that includes, among other things, a jar file for each Java_binary( name, deps, srcs, data, resources, args, classpath_resources, compatible_with, create_executable, deploy_env, deploy_manifest_lines, deprecation, distribs, env, exec_compatible_with, exec_properties, features, javacopts, jvm_flags, launcher, licenses, main_class, output_licenses, plugins, resource_jars, resource_strip_prefix, restricted_to, runtime_deps, stamp, tags, target_compatible_with, testonly, toolchains, use_launcher, use_testrunner, visibility)īuilds a Java archive ("jar file"), plus a wrapper shell script with the same name as the rule.