Using Hilla project as library

Hello.
I have a Hilla 27.0 React project which I packed as a library, because it should be included to huge and complex project as optional.
So, I did few changes:
build.gradle

plugins {
	id 'java-library'
...
}
...

jar {
	enabled = true
	exclude 'com/example/Application.class'
	exclude 'application.properties'
}

Config.java (loads from org.springframework.boot.autoconfigure.AutoConfiguration.imports)

@Theme(value = "hilla-react-app")
@Configuration
@Import({
		RestConfig.class,
		Endpoint.class,
		Service.class,
		Dao.class,
})
public class Config implements AppShellConfigurator {
}

This project works successfully when I run it by itself.

When I include it as a dependency in main project (build as production mode) and go to UI, browser loads index.html from library/META-INF/VAADIN/webapp successfully.

But index.html tries to load JS file from library/META-INF/VAADIN/webapp/VAADIN/build and gets 302 Found (so request should be redirected).

Does someone have an idea how to fix it?

The issue was due to main project had

spring.mvc.servlet.path = /srr

Disabling this option solved the problem.

1 Like