Skip to main content

juneau-shaded-all

The juneau-shaded-all artifact is the complete Juneau framework bundled in a single 4.0 MB JAR file. It includes all core modules, REST client, REST server, Spring Boot integration, bean DTOs, and microservice modules.

What's Included

This artifact includes everything:

Core Modules

  • juneau-common - Core utilities
  • juneau-assertions - Fluent assertions API
  • juneau-bct - Bean-Centric Testing framework
  • juneau-config - Configuration file API
  • juneau-marshall - All serializers/parsers (JSON, XML, HTML, MessagePack, etc.)

REST Modules

  • juneau-rest-common - Common REST APIs
  • juneau-rest-client - REST client API
  • juneau-rest-server - REST server API
  • juneau-rest-server-rdf - RDF support for servers
  • juneau-rest-server-springboot - Spring Boot integration
  • juneau-rest-mock - REST testing utilities

Bean DTOs

  • juneau-bean-common - Common bean utilities
  • juneau-bean-atom - ATOM feed beans
  • juneau-bean-html5 - HTML5 element beans
  • juneau-bean-jsonschema - JSON Schema beans (Draft 2020-12)
  • juneau-bean-openapi-v3 - OpenAPI 3.0 beans
  • juneau-bean-swagger-v2 - Swagger 2.0 beans

Microservice Modules

  • juneau-microservice-core - Core microservice functionality
  • juneau-microservice-jetty - Jetty-based microservice

Use Cases

Use juneau-shaded-all when you:

  • Want everything - Need full access to all Juneau features
  • Are getting started - Simplest way to explore Juneau
  • Build complete applications - Need both client and server functionality
  • Use Bazel or similar build systems - Simplifies strict dependency management
  • Develop microservices - Includes microservice support
  • Need maximum flexibility - Have all features available without additional dependencies

Maven Dependency

<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-shaded-all</artifactId>
<version>${juneau.version}</version>
</dependency>

Bazel Dependency

maven_jar(
name = "juneau_all",
artifact = "org.apache.juneau:juneau-shaded-all:${juneau.version}",
)

# Common external dependencies
maven_jar(
name = "httpclient5",
artifact = "org.apache.httpcomponents.client5:httpclient5:5.2.1",
)

maven_jar(
name = "jakarta_servlet_api",
artifact = "jakarta.servlet:jakarta.servlet-api:6.1.0",
)

java_binary(
name = "my_app",
srcs = glob(["src/**/*.java"]),
deps = [
"@juneau_all//jar",
"@httpclient5//jar",
"@jakarta_servlet_api//jar",
],
main_class = "com.example.MyApp",
)

External Dependencies

juneau-shaded-all requires the following external dependencies:

For REST Client

  • Apache HttpClient 5.2+
  • Apache HttpCore 5.2+

For REST Server

  • Jakarta Servlet API 6.1+
  • Servlet Container (Jetty, Tomcat, etc.)

For Spring Boot

  • Spring Boot Starter Web 3.0+

Optional

  • Jakarta XML Bind API 3.0+ - For XML serialization
  • Spring Boot Starter Security - For Spring Security integration

Example: Complete Microservice

import org.apache.juneau.microservice.jetty.*;
import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.rest.servlet.*;

// Main application
public class MyMicroservice {
public static void main(String[] args) throws Exception {
JettyMicroservice
.create()
.args(args)
.servlet(RootResource.class)
.build()
.start()
.join();
}
}

// Root resource
@Rest(
path="/",
title="My Microservice",
description="Complete REST API example"
)
public class RootResource extends BasicRestServlet {

@RestGet(path="/")
public String home() {
return "Welcome to My Microservice!";
}

@RestGet(path="/api/data")
public List<Data> getData() {
return dataService.getAll();
}

@RestPost(path="/api/data")
public Data createData(@Content Data data) {
return dataService.create(data);
}
}

Example: Full-Stack Application

// Server-side REST API
@Rest(path="/api")
public class MyApi extends BasicRestServlet {

@RestGet(path="/users")
public List<User> getUsers() {
return userService.getAllUsers();
}

@RestPost(path="/users")
public User createUser(@Content User user) {
return userService.createUser(user);
}
}

// Client-side consumption
public class MyClient {
public static void main(String[] args) {
try (RestClient client = RestClient.create()
.json()
.rootUrl("http://localhost:8080")
.build()) {

// GET users
List<User> users = client.get("/api/users")
.run()
.getContent().as(User[].class);

// POST new user
User newUser = new User("John", "john@example.com");
User created = client.post("/api/users")
.content(newUser)
.run()
.getContent().as(User.class);

System.out.println("Created: " + created.getName());
}
}
}

Example: Spring Boot Application

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MySpringBootApp {
public static void main(String[] args) {
SpringApplication.run(MySpringBootApp.class, args);
}
}

@Rest(path="/api/products")
@Component
public class ProductResource extends SpringRestServlet {

@Autowired
private ProductRepository productRepository;

@RestGet
public List<Product> getAllProducts() {
return productRepository.findAll();
}

@RestGet(path="/{id}")
public Product getProduct(@Path long id) {
return productRepository.findById(id)
.orElseThrow(() -> new NotFound("Product not found"));
}

@RestPost
@Transactional
public Product createProduct(@Content Product product) {
return productRepository.save(product);
}
}

Example: Testing with All Features

import static org.apache.juneau.junit.bct.BctAssertions.*;
import org.apache.juneau.rest.mock.*;

@Test
public void testCompleteWorkflow() throws Exception {
// Bean testing
User user = new User("John", "john@example.com");
assertBean(user)
.is("name", "John")
.is("email", "john@example.com");

// Serialization testing
assertBean(user).asJson()
.is("{name:'John',email:'john@example.com'}");

// REST API testing
MockRestClient client = MockRestClient.create(MyApi.class)
.json()
.build();

User created = client.post("/users")
.content(user)
.run()
.assertStatus().is(201)
.getContent().as(User.class);

assertBean(created).is("name", "John");
}

Features at a Glance

Serialization

  • JSON, XML, HTML, RDF, MessagePack, CSV, SOAP, UON, OpenAPI, PlainText
  • Automatic content negotiation
  • Streaming support
  • Custom serializers/parsers

REST Client

  • Fluent API
  • Remote proxies
  • Authentication (Basic, Bearer, OAuth2, Custom)
  • Interceptors and retries
  • Connection pooling

REST Server

  • Annotation-based routing
  • Swagger/OpenAPI integration
  • Guards and matchers
  • Converters and validators
  • File uploads/downloads
  • Server-sent events

Configuration

  • Hierarchical config files
  • Variable resolution
  • Listeners and watchers
  • Multiple formats

Testing

  • Fluent assertions
  • Bean-centric testing
  • Mock REST clients/servers
  • Deep property navigation

Microservices

  • Jetty integration
  • Configuration management
  • Lifecycle hooks
  • Health checks and metrics

Performance

  • JAR Size: 4.0 MB (all features included)
  • Memory: Efficient bean introspection with caching
  • Serialization: Fast, memory-efficient
  • Thread-Safe: All components are thread-safe
  • Startup: Minimal - no classpath scanning or code generation

When NOT to Use

Consider using more specific shaded artifacts if:

  • Building a library - Other projects may not need all features
  • Size constraints - Use juneau-shaded-core (2.1 MB) for core-only
  • Client only - Use juneau-shaded-rest-client (3.8 MB)
  • Server only - Use juneau-shaded-rest-server (3.8 MB)

Comparison with Other Shaded Artifacts

ArtifactSizeUse When
juneau-shaded-core2.0 MBOnly need marshalling/config
juneau-shaded-rest-client3.8 MBBuilding REST clients
juneau-shaded-rest-server3.8 MBBuilding REST servers
juneau-shaded-rest-server-springboot3.8 MBUsing Spring Boot
juneau-shaded-all4.0 MBNeed everything

Migration from Individual Modules

Before (managing many dependencies):

<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-marshall</artifactId>
</dependency>
<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-rest-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-rest-server</artifactId>
</dependency>
<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-rest-server-springboot</artifactId>
</dependency>
<!-- ... many more -->

After (one dependency):

<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-shaded-all</artifactId>
<version>${juneau.version}</version>
</dependency>

All imports and API usage remain exactly the same!

Next Steps

Discussion

Share feedback or follow-up questions for this page directly through GitHub.