Build Sample App
On the command line, move to the logpresso-sample-app directory and run mvn clean package to build.
cmd> mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< com.logpresso.sonar:logpresso-sample-app >--------------
[INFO] Building Logpresso Sample App 1.1.2608.0
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ logpresso-sample-app ---
[INFO] Deleting C:\github\logpresso-app-examples\logpresso-sample-app\target
[INFO]
[INFO] --- frontend:1.15.0:install-node-and-npm (install-node-npm) @ logpresso-sample-app ---
[INFO] Installing node version v20.18.0
[INFO] Installed node locally.
[INFO] Installing npm version 10.9.0
[INFO] Installed npm locally.
[INFO]
[INFO] --- frontend:1.15.0:npm (npm-install) @ logpresso-sample-app ---
[INFO] Running 'npm install' in C:\github\logpresso-app-examples\logpresso-sample-app\src\main\ui
[INFO] added 48 packages, and audited 49 packages in 20s
[INFO] found 0 vulnerabilities
[INFO]
[INFO] --- frontend:1.15.0:npm (npm-build) @ logpresso-sample-app ---
[INFO] Running 'npm run build' in C:\github\logpresso-app-examples\logpresso-sample-app\src\main\ui
[INFO] > logpresso-sample-app-ui@1.1.2608.0 build
[INFO] > tsc -b && vite build
[INFO] vite v6.4.3 building for production...
[INFO] 37 modules transformed.
[INFO] ../resources/WEB-INF/index.html 0.42 kB gzip: 0.27 kB
[INFO] ../resources/WEB-INF/assets/index-DpGY6jAl.css 10.88 kB gzip: 3.17 kB
[INFO] ../resources/WEB-INF/assets/index-B5j1U51f.js 208.08 kB gzip: 66.03 kB
[INFO] built in 1.43s
[INFO]
[INFO] --- resources:3.5.0:resources (default-resources) @ logpresso-sample-app ---
[INFO] Copying 5 resources from src\main\resources to target\classes
[INFO]
[INFO] --- compiler:3.8.1:compile (default-compile) @ logpresso-sample-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 12 source files to C:\github\logpresso-app-examples\logpresso-sample-app\target\classes
[INFO]
[INFO] --- surefire:3.6.0-M1:test (default-test) @ logpresso-sample-app ---
[INFO]
[INFO] --- bundle:5.1.4:bundle (default-bundle) @ logpresso-sample-app ---
[WARNING] Bundle com.logpresso.sonar:logpresso-sample-app:bundle:1.1.2608.0 : Unused Import-Package instructions: [com.logpresso.sonar.api.*]
[INFO] Building bundle: C:\github\logpresso-app-examples\logpresso-sample-app\target\logpresso-sample-app-1.1.2608.0.jar
[INFO] Writing manifest: C:\github\logpresso-app-examples\logpresso-sample-app\target\classes\META-INF\MANIFEST.MF
[INFO]
[INFO] --- ipojo:1.12.1.asm8:ipojo-bundle (default) @ logpresso-sample-app ---
[INFO] Start bundle manipulation
[INFO] No metadata file found - trying to use only annotations
[INFO] Input Bundle File : C:\github\logpresso-app-examples\logpresso-sample-app\target\logpresso-sample-app-1.1.2608.0.jar
[INFO] Apache Felix iPOJO Manipulator - 1.12.1.asm8
[INFO] Bundle manipulation - SUCCESS
[INFO]
[INFO] --- antrun:3.1.0:run (default) @ logpresso-sample-app ---
[INFO] Executing tasks
[INFO] [copy] Copying 1 file to C:\github\logpresso-app-examples\logpresso-sample-app\target
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:01 min
The build breaks into three parts.
The frontend build runs first. The install-node-and-npm step installs Node.js and npm into the src/main/ui/node directory, npm install downloads the dependencies, and npm run build builds the screen into the src/main/resources/WEB-INF directory. You do not need Node.js installed beforehand because this step fetches the versions it needs. This step appears only in an app that includes an XDR UI.
Java compilation follows. The Copying 5 resources entry copies the app manifest, the logo, and the three screen files just produced into the bundle.
Bundling and packaging come last. maven-bundle-plugin creates the OSGi bundle, maven-ipojo-plugin recognizes the iPOJO annotations and instruments the bytecode, and maven-antrun-plugin copies the app file.
A successful build produces two files in the target directory.
logpresso-sample-app-1.1.2608.0.jar the OSGi bundle
logpresso-sample-app-1.1.2608.0.app the app file you install in the web console
The two files have the same contents. The app file is the bundle JAR copied with a different extension.
The first build takes longer because it downloads Node.js and the npm dependencies. From the second build on, it reuses what it downloaded.