Spring Boot: Replace config.js for Webapps-Configuration

Hi all

I have the same problem, which was not solved in Spring Boot + WebApps + Localization + Customization. In a nutshell: I cannot override the config.js for the Webapps (app/tasklist/scripts/config.js for example).

I read the following ressources:

  1. Internationalization in the Camunda BPM Tasklist
  2. Configuration
  3. provide example with static web resources/customized cockpit

I tried several combinations. These are my findings so far:

  1. I’m able to serve a static resource (config.js for example), if I put it in a sub-folder of /src/main/resources/static as long as this folder is not called “app”.
  2. So, for instance, putting config.js in /src/main/resources/static/test, I can browse it by http://localhost:8080/test/config.js.
  3. As soon as I try to serve any resource (not only existing ones like config.js) in /src/main/resources/static/app or a subfolder of it, I can’t browse this resource, even though it gets in the correct target directory, building the application.

What is the reason for these findings?

1 Like

Hi @scepbjoern,

I just uploaded a snippet to our snippet section that showcases how to customize the Camunda Webapps when using spring-boot: https://github.com/camunda-consulting/code/tree/master/snippets/springboot-customized-webapps

Actually, replacing the config.js is included in that snippet.

Best,
Ragnar

5 Likes

Hi @Ragnar

Wow! Thank you very much for your work, which is highly apreciated. I never thought, that customizing the Webapps is so much more complicate with Spring Boot than without. Because most of the time, life is so much easier with Spring Boot, but not in this case.

But with your “snippets” and the explanations in the ReadMe, it worked as it should as you can see in the attached image.

Kind regards
Björn

1 Like

I was able to override files in the camunda 7.9.0 webjar, simply by putting them into src/main/resources/META-INF/resources. In there I have app/tasklist/scripts/config.js and it overrides the one from the webjar.

image

From 7.10.0 the layout has changed, use src/main/resources/webjars/camunda/app. You can find out where spring-boot is searching for resources by debugging org.springframework.web.servlet.resource.PathResourceResolver#getResource(), look at the incoming locations.

2 Likes

Using src/main/resources/webjars/camunda/app/tasklist/scripts/config.js doesn’t work for me in 7.10.0. No error, but the original config.js doesn’t get overridden.

Which exact version of spring boot and camunda spring boot starter are you using? Check
https://docs.camunda.org/manual/latest/user-guide/spring-boot-integration/version-compatibility/

If you put a breakpoint in PathResourceResolver#getResource, which locations do you get?

Spring Boot 2.1.5.RELEASE, camunda-bpm-spring-boot-starter 3.2.4, Camunda 7.10.0

When I check with a breakpoint in the PathResourceResolver, it’s requesting tasklist/scripts/config.js, and the default one from the Maven webjar is being returned, not the local one that I have in my project.

@amoe Did you exclude camunda-webapp-webjar in your pom, like this?

<dependency>
		<groupId>org.camunda.bpm.springboot</groupId>
		<artifactId>
			camunda-bpm-spring-boot-starter-webapp
		</artifactId>
		<version>${camunda.spring.boot.version}</version>
		<exclusions>
			<exclusion>
				<groupId>org.camunda.bpm.webapp</groupId>
				<artifactId>camunda-webapp-webjar</artifactId>
			</exclusion>
		</exclusions>
	</dependency>

@vendel.saghy I think that we are talking about two separate things here.

If I understood @dschulten correctly, he says that it’s possible to override config.js without building your own version of the webjar. He’s saying that you can use local files in your project to override the ones from the webjar, without excluding the default webjar from the POM.

I know how to build my own version of the webjar to override it, and I’ve already done that (and it works ok). But I’m looking for an easier way, to avoid maintaining yet another Maven artifact.

1 Like

@amoe Ahh, OK, sorry, I didn’t read the previous posts carefully enough…

I am still on boot 2.0.x because of https://app.camunda.com/jira/plugins/servlet/mobile#issue/CAM-10187. Something might have changed for boot 2.1.x. so that the simple override no longer works. At https://github.com/camunda-consulting/code/tree/master/snippets/springboot-customized-webapps you find a setup which automatically downloads, unpacks and customizes the webjar, maybe that helps.

If someone is still interested in customizing the Webapps with a separate maven project: For our eUmzug-project I updated my solution for Camunda 7.8 to working in 7.10 (and probably also 7.11). The parts you’ll need are:

  1. The maven project with the customizations -> see here
  2. The dependency declaration to this project in the pom.xml of the maven project, which will use the customizations -> see the last part of the README here
  3. In the same pom.xml you will have to ensure, that it uses the exact same version of Camunda and Spring Boot, which you’ll declared in the project with the customizations
1 Like

Hi, @scepbjoern, i followed your solution to customize the webapps and it works ok except changing the name of the app, which only works on TaskList and Welcome apps. I’m on 7.11.0. Do you know what could be happening with this?

Regards!

Hi @amoe did you manage to override config.js or ended up creating/using your version of webjar ?

Hi, I managed to override config.js :slight_smile: . you need to give complete path of config.js in exclude tag of maven dependency plugin.

1 Like

For spring boot app create META-INF folder under resources folder and create the directory structure like below

resources.webjars.camunda.app.tasklist.scripts

Inside the above folder structure place config.js file which will override the original one

1 Like