From bb7cdd286dd7ec082388e023edd610519c84f537 Mon Sep 17 00:00:00 2001 From: Joe Di Pol Date: Mon, 18 Sep 2023 13:53:07 -0700 Subject: [PATCH] Do not deploy helidon-inject-maven-plugin --- examples/inject/README.md | 1 - examples/inject/application/README.md | 50 -------- examples/inject/application/pom.xml | 117 ------------------ .../examples/inject/application/Main.java | 39 ------ .../inject/application/package-info.java | 20 --- .../src/main/resources/logging.properties | 26 ---- .../application/InjectionApplicationTest.java | 57 --------- examples/inject/pom.xml | 1 - inject/maven-plugin/pom.xml | 1 + 9 files changed, 1 insertion(+), 311 deletions(-) delete mode 100644 examples/inject/application/README.md delete mode 100644 examples/inject/application/pom.xml delete mode 100644 examples/inject/application/src/main/java/io/helidon/examples/inject/application/Main.java delete mode 100644 examples/inject/application/src/main/java/io/helidon/examples/inject/application/package-info.java delete mode 100644 examples/inject/application/src/main/resources/logging.properties delete mode 100644 examples/inject/application/src/test/java/io/helidon/examples/inject/application/InjectionApplicationTest.java diff --git a/examples/inject/README.md b/examples/inject/README.md index 081854eeae7..3f91209b293 100644 --- a/examples/inject/README.md +++ b/examples/inject/README.md @@ -9,4 +9,3 @@ Suggested path to follow: 2. [providers](./providers) 3. [configdriven](./configdriven) 4. [interceptors](./interceptors) -5. [application](./application) diff --git a/examples/inject/application/README.md b/examples/inject/application/README.md deleted file mode 100644 index ae4f3347478..00000000000 --- a/examples/inject/application/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Helidon Injection Application Example - -This example shows how a multi-module application can be created using Helidon Injection. The -[Main.java](./src/main/java/io/helidon/examples/inject/application/Main.java) class shows: - -* multi-module usage (i.e., this module amalgamates [basics](../basics), [providers](../providers), [configdriven](../configdriven), and [interceptors](../interceptors) ). -* compile-time generation of the DI model for the entire multi-module project using the _inject-maven-plugin_ (see [pom.xml](./pom.xml)). -* TestingSupport in [ApplicationTest](src/test/java/io/helidon/examples/inject/application/InjectionApplicationTest.java) - -## Build and run - -```bash -mvn package -java -jar target/helidon-examples-inject-application.jar -``` - -Expected Output: -``` -Startup service providers (ranked according to weight, pre-activated): [ToolBox:INIT, CircularSaw:INIT, NailGun:INIT, TableSaw:INIT] -Highest weighted service provider: NailGun:INIT ------ -Nail Gun: (nail provider=NailProvider:INIT); initialized -Highest weighted service provider (after activation): io.helidon.examples.inject.providers.NailGun@7cbd9d24 ------ -Preferred Big Tool: Big Hammer -Optional Little Hammer: Optional[Little Hammer] ------ -ToolBox Contents: -Hammer:INIT -BigHammer:ACTIVE -LittleHammer:ACTIVE -Drill{root}:PENDING -AngleGrinderSaw:INIT -CircularSaw:INIT -HandSaw:INIT -NailGun:ACTIVE -TableSaw:INIT ------ -io.helidon.examples.inject.providers.CircularSaw:: will be injected with Optional.empty -Circular Saw: (blade=null); initialized -io.helidon.examples.inject.providers.TableSaw:: will be injected with Optional[LARGE Blade] -Table Saw: (blade=LARGE Blade); initialized -All service providers (after all activations): [ToolBox:ACTIVE, CircularSaw:ACTIVE, NailGun:ACTIVE, TableSaw:ACTIVE] ------ -Service lookup count: 2 -``` - -While the output of this example may look similar to the previous [providers](../providers) example, the implementation is different since this example builds (at compile time) [Application.java](target/generated-sources/annotations/io/helidon/examples/inject/application/Injection$$Application.java). This establishes direct bindings to each and every injection point in your application avoiding runtime resolution with the exception for truly dynamic runtime providers (i.e., anything that is config-driven services or _Provider_ type implementations). - -Note that the lookup count is 2 based upon the direct lookup calls used in the delegated [Main](../basics/src/main/java/io/helidon/examples/inject/basics/Main.java). diff --git a/examples/inject/application/pom.xml b/examples/inject/application/pom.xml deleted file mode 100644 index ffb98f326a9..00000000000 --- a/examples/inject/application/pom.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - 4.0.0 - - io.helidon.applications - helidon-se - 4.0.0-SNAPSHOT - ../../../applications/se/pom.xml - - io.helidon.examples.inject - helidon-examples-inject-application - Helidon Examples Injection Application - - - Example usages of an Injection Application. - - - - io.helidon.examples.inject.providers.Main - - - - - io.helidon.examples.inject - helidon-examples-inject-providers - ${helidon.version} - - - io.helidon.examples.inject - helidon-examples-inject-configdriven - ${helidon.version} - - - jakarta.annotation - jakarta.annotation-api - provided - - - org.hamcrest - hamcrest-all - test - - - org.junit.jupiter - junit-jupiter-api - test - - - io.helidon.inject - helidon-inject-testing - test - - - - - - - io.helidon.inject - helidon-inject-maven-plugin - ${helidon.version} - - - compile - compile - - application-create - - - - testCompile - test-compile - - test-application-create - - - - - io.helidon.examples.inject.application - - NAMED - - io.helidon.examples.inject.providers.BladeProvider - io.helidon.examples.inject.providers.NailProvider - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-libs - - - - - - diff --git a/examples/inject/application/src/main/java/io/helidon/examples/inject/application/Main.java b/examples/inject/application/src/main/java/io/helidon/examples/inject/application/Main.java deleted file mode 100644 index 0ceb4a7fb74..00000000000 --- a/examples/inject/application/src/main/java/io/helidon/examples/inject/application/Main.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.inject.application; - -import io.helidon.inject.api.Metrics; -import io.helidon.inject.api.InjectionServices; - -/** - * Application example. Uses the same {@code main()} as {@link io.helidon.examples.inject.basics.Main}. - */ -public class Main extends io.helidon.examples.inject.basics.Main { - - /** - * Executes the example. - * - * @param args arguments - */ - public static void main(String... args) { - io.helidon.examples.inject.basics.Main.main(args); - - Metrics metrics = InjectionServices.injectionServices().orElseThrow().metrics().get(); - System.out.println("Service lookup count: " + metrics.lookupCount().get()); - } - -} diff --git a/examples/inject/application/src/main/java/io/helidon/examples/inject/application/package-info.java b/examples/inject/application/src/main/java/io/helidon/examples/inject/application/package-info.java deleted file mode 100644 index e63973db58d..00000000000 --- a/examples/inject/application/src/main/java/io/helidon/examples/inject/application/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Examples of multi-module Application generation in Injection. - */ -package io.helidon.examples.inject.application; diff --git a/examples/inject/application/src/main/resources/logging.properties b/examples/inject/application/src/main/resources/logging.properties deleted file mode 100644 index bd06e0ed087..00000000000 --- a/examples/inject/application/src/main/resources/logging.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -handlers = java.util.logging.ConsoleHandler - -java.util.logging.ConsoleHandler.level = FINEST -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format = [%1$tc] %4$s: %2$s - %5$s %6$s%n - -.level = INFO -io.helidon.config.level = WARNING -io.helidon.config.examples.level = FINEST diff --git a/examples/inject/application/src/test/java/io/helidon/examples/inject/application/InjectionApplicationTest.java b/examples/inject/application/src/test/java/io/helidon/examples/inject/application/InjectionApplicationTest.java deleted file mode 100644 index 31ccbdc289f..00000000000 --- a/examples/inject/application/src/test/java/io/helidon/examples/inject/application/InjectionApplicationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2023 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.helidon.examples.inject.application; - -import io.helidon.config.Config; -import io.helidon.config.ConfigSources; -import io.helidon.inject.api.InjectionServices; -import io.helidon.inject.api.Services; -import io.helidon.inject.testing.InjectionTestingSupport; - -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Test; - -import static io.helidon.inject.testing.InjectionTestingSupport.testableServices; - -class InjectionApplicationTest { - - protected InjectionServices injectionServices; - protected Services services; - - @AfterAll - static void tearDown() { - InjectionTestingSupport.resetAll(); - } - - protected void resetWith(Config config) { - InjectionTestingSupport.resetAll(); - this.injectionServices = testableServices(config); - this.services = injectionServices.services(); - } - - @Test - void main() { - Config config = Config.builder() - .addSource(ConfigSources.classpath("application.yaml")) - .disableSystemPropertiesSource() - .disableEnvironmentVariablesSource() - .build(); - resetWith(config); - Main.main(); - } - -} diff --git a/examples/inject/pom.xml b/examples/inject/pom.xml index 07ee8d010c7..1744f96a513 100644 --- a/examples/inject/pom.xml +++ b/examples/inject/pom.xml @@ -35,7 +35,6 @@ providers configdriven interceptors - application diff --git a/inject/maven-plugin/pom.xml b/inject/maven-plugin/pom.xml index e2f4f0e324e..8b71c56647b 100644 --- a/inject/maven-plugin/pom.xml +++ b/inject/maven-plugin/pom.xml @@ -32,6 +32,7 @@ maven-plugin + true 2.7.0 3.3.0 3.9.3