File tree Expand file tree Collapse file tree
src/main/java/com/baeldung
src/main/java/com/baeldung Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_jar" )
3+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
4+
5+
6+ RULES_JVM_EXTERNAL_TAG = "2.0.1"
7+ RULES_JVM_EXTERNAL_SHA = "55e8d3951647ae3dffde22b4f7f8dee11b3f70f3f89424713debd7076197eaca"
8+
9+ http_archive (
10+ name = "rules_jvm_external" ,
11+ strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG ,
12+ sha256 = RULES_JVM_EXTERNAL_SHA ,
13+ url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG ,
14+ )
15+
16+ load ("@rules_jvm_external//:defs.bzl" , "maven_install" )
17+
18+ maven_install (
19+ artifacts = [
20+ "org.apache.commons:commons-lang3:3.9"
21+ ],
22+ repositories = [
23+ "https://repo1.maven.org/maven2" ,
24+ ]
25+ )
26+
27+ http_jar (
28+ name = "apache-commons-lang" ,
29+ url = "https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar"
30+ )
31+
Original file line number Diff line number Diff line change 1+
2+ java_binary (
3+ name = "BazelApp" ,
4+ srcs = glob (["src/main/java/com/baeldung/*.java" ]),
5+ main_class = "com.baeldung.BazelApp" ,
6+ deps = ["//bazelgreeting:greeter" , "@maven//:org_apache_commons_commons_lang3" ]
7+ )
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <parent >
6+ <artifactId >bazel</artifactId >
7+ <groupId >com.baeldung</groupId >
8+ <version >1.0.0-SNAPSHOT</version >
9+ </parent >
10+ <modelVersion >4.0.0</modelVersion >
11+
12+ <artifactId >bazelapp</artifactId >
13+
14+ <dependencies >
15+ <dependency >
16+ <groupId >com.baeldung</groupId >
17+ <artifactId >bazelgreeting</artifactId >
18+ <version >1.0.0-SNAPSHOT</version >
19+ </dependency >
20+ <dependency >
21+ <groupId >org.apache.commons</groupId >
22+ <artifactId >commons-lang3</artifactId >
23+ <version >3.9</version >
24+ </dependency >
25+ </dependencies >
26+
27+
28+ </project >
Original file line number Diff line number Diff line change 1+ package com .baeldung ;
2+
3+ import com .baeldung .Greetings ;
4+ import org .apache .commons .lang3 .StringUtils ;
5+
6+ public class BazelApp {
7+
8+ public static void main (String ... args ) {
9+ Greetings greetings = new Greetings ();
10+
11+ System .out .println (greetings .greet ("Bazel" ));
12+
13+ System .out .println (StringUtils .lowerCase ("Bazel" ));
14+ }
15+ }
Original file line number Diff line number Diff line change 1+
2+ java_library (
3+ name = "greeter" ,
4+ srcs = glob (["src/main/java/com/baeldung/*.java" ]),
5+ visibility = ["//bazelapp:__pkg__" ]
6+ )
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <parent >
6+ <artifactId >bazel</artifactId >
7+ <groupId >com.baeldung</groupId >
8+ <version >1.0.0-SNAPSHOT</version >
9+ </parent >
10+ <modelVersion >4.0.0</modelVersion >
11+
12+ <artifactId >bazelgreeting</artifactId >
13+
14+
15+ </project >
Original file line number Diff line number Diff line change 1+ package com .baeldung ;
2+
3+ public class Greetings {
4+
5+ public String greet (String name ) {
6+ return "Hello " .concat (name );
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <parent >
6+ <artifactId >parent-modules</artifactId >
7+ <groupId >com.baeldung</groupId >
8+ <version >1.0.0-SNAPSHOT</version >
9+ </parent >
10+ <modelVersion >4.0.0</modelVersion >
11+
12+ <artifactId >bazel</artifactId >
13+ <packaging >pom</packaging >
14+ <modules >
15+ <module >bazelgreeting</module >
16+ <module >bazelapp</module >
17+ </modules >
18+
19+
20+ </project >
You can’t perform that action at this time.
0 commit comments