Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Config Guide to describe how to change pom for custom main class #3083

Merged
merged 2 commits into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/mp/guides/03_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ For example, if you specify a custom server port in `META-INF/microprofile-confi
then your server will listen on that port.

A main class is also required to start up the server and run the
application. If you don't use Helidon's built-in main class you can
define your own:
application. By default the Quickstart sample project uses the built-in
Helidon main class. In this guide you want to use your own main class so you have
more control over the server initialization. First define your own `Main`:

[source,java]
.src/main/java/io/helidon/examples/quickstart/mp/Main.java
Expand Down Expand Up @@ -119,6 +120,18 @@ this class has an empty no-args constructor to make sure this class
cannot be instantiated.
<2> The MicroProfile server is started with the default configuration.

Next change the project's `pom.xml` to use your main class:

[source,xml]
.pom.xml
----
<properties>
<mainClass>io.helidon.examples.quickstart.mp.Main</mainClass>
</properties>
----

This property will be used to set the `Main-Class` attribute in the application jar's MANIFEST.

In your application code, Helidon uses the default configuration when you create a `Server` object without a custom `Config` object.
See the following code from the project you created.

Expand Down