Repository: provectus/kafka-ui
Issue: Request: a command to compile just `kafka-ui-api`, ignoring the frontend
Labels: type/enhancement
scope/backend
status/accepted
type/chore

### Is your proposal related to a problem?

I'd like to be able to iterate building the Java portion of `kafka-ui` without building the frontend.

I assumed this would work, but it runs npm:
```
cd kafka-ui-api
 ./mvnw compile -Pprod 
```

I was told to open this issue on Discord.

### Describe the solution you'd like
```
cd kafka-ui-api
 ./mvnw compile -Pprod 
```
The above should compile just the backend.


Issue comments:
I can take this one. What about this solution? specifying "api-prod" as arg.
```
cd kafka-ui-api
 ./mvnw compile -Papi-prod 
```

Actually the ` ./mvnw compile -Pprod` doesn't compile the "kafka-ui-contract" (or am I wrong?). So when compiling the "kafka-ui-api" if you dont compile the contract you can receive some erros (if the contracts were updated). 

Maybe this is an another issue?
Sure, thanks.
Yeah, let's do something like this.
It depends on the directory you run this command in.

Since we don't have the wrapper as part of the modules what is the approach we want to follow regarding this request? Do we want to skip frontend build for ui-api and ui-contract?

By running something like this ./mvnw clean install -Pprod -DskipUIBuild=true

And changing this on both POM's: 

**configuration.skip.skipUIBuild**

Original Request is based on this possibility but it is not anymore like this:

cd kafka-ui-api
 ./mvnw compile -Pprod 
 
 @Haarolean 
> Since we don't have the wrapper as part of the modules what is the approach we want to follow regarding this request? Do we want to skip frontend build for ui-api and ui-contract?
> 
> By running something like this ./mvnw clean install -Pprod -DskipUIBuild=true
> 
> And changing this on both POM's:
> 
> **configuration.skip.skipUIBuild**
> 
> Original Request is based on this possibility but it is not anymore like this:
> 
> cd kafka-ui-api ./mvnw compile -Pprod
> 
> @Haarolean

what if we create a new profile with skipUIBuild property set to enabled by default?
> > Since we don't have the wrapper as part of the modules what is the approach we want to follow regarding this request? Do we want to skip frontend build for ui-api and ui-contract?
> > By running something like this ./mvnw clean install -Pprod -DskipUIBuild=true
> > And changing this on both POM's:
> > **configuration.skip.skipUIBuild**
> > Original Request is based on this possibility but it is not anymore like this:
> > cd kafka-ui-api ./mvnw compile -Pprod
> > @Haarolean
> 
> what if we create a new profile with skipUIBuild property set to enabled by default?

That is what the closed PR was doing and was pushed back due to duplicated code. 
@Haarolean Lets not create unnecessary profiles. I suggested simple solution here https://github.com/provectus/kafka-ui/pull/1696#discussion_r830601917 . 
In should work like `./mvnw compile -DskipUiBuild=true`. 
> @Haarolean Lets not create unnecessary profiles. I suggested simple solution here [#1696 (comment)](https://github.com/provectus/kafka-ui/pull/1696#discussion_r830601917) . In should work like `./mvnw compile -DskipUiBuild=true`.

Do we want it just for api or also for contract project?
> @Haarolean Lets not create unnecessary profiles. I suggested simple solution here [#1696 (comment)](https://github.com/provectus/kafka-ui/pull/1696#discussion_r830601917) . In should work like `./mvnw compile -DskipUiBuild=true`.

https://github.com/provectus/kafka-ui/pull/2424 This is solution 2

Pull request review comments:

Patch that resolved the issue:
diff --git a/documentation/project/contributing/building.md b/documentation/project/contributing/building.md
index 21562426e5e..7b530829b92 100644
--- a/documentation/project/contributing/building.md
+++ b/documentation/project/contributing/building.md
@@ -19,6 +19,13 @@ docker-compose -f ./documentation/compose/kafka-clusters-only.yaml up -d
 
 Then, start the app.
 
+### Building only the API
+
+To build only the kafka-ui-api you can use this command:
+```sh
+./mvnw -f kafka-ui-api/pom.xml clean install -Pprod -DskipUIBuild=true
+```
+
 ## Where to go next
 
 In the next section, you'll [learn how to run the application](running.md).
\ No newline at end of file
diff --git a/kafka-ui-api/pom.xml b/kafka-ui-api/pom.xml
index 53eb24731d7..5c00dc0f6d9 100644
--- a/kafka-ui-api/pom.xml
+++ b/kafka-ui-api/pom.xml
@@ -404,6 +404,7 @@
                         <artifactId>frontend-maven-plugin</artifactId>
                         <version>${frontend-maven-plugin.version}</version>
                         <configuration>
+                            <skip>${skipUIBuild}</skip>
                             <workingDirectory>../kafka-ui-react-app</workingDirectory>
                             <environmentVariables>
                                 <VITE_TAG>${project.version}</VITE_TAG>


Test patch: