Quarkus: java.util.NoSuchElementException: Property quarkus.application.name not found

Created on 8 May 2020  路  9Comments  路  Source: quarkusio/quarkus

Describe the bug

Config quarkus.application.name not accessible in application.properties

Expected behavior

${quarkus.application.name} should be interpolated.

Actual behavior

java.util.NoSuchElementException: Property quarkus.application.name not found

To Reproduce
Steps to reproduce the behavior:

  1. Generate Camel Quarkus (Gradle) project on Quarkus Starter
  2. Set in application.properties :

`# Configuration file

camel.context.name = ${quarkus.application.name}
`

  1. Run:

./gradlew quarkusDev

Configuration

# Configuration file
camel.context.name = ${quarkus.application.name}

Environment (please complete the following information):

  • Output of uname -a or ver: 19.4.0 Darwin Kernel Version 19.4.0
  • Output of java -version: openjdk version "11.0.6" 2020-01-14 LTS
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.4.2
  • Build tool (ie. output of mvnw --version or gradlew --version): Gradle 6.3
aregradle kinbug

All 9 comments

This only affects tests (a known limitation), dev-mode and the jar work properly.

I propose that you do the following in order to make the property available in tests:

%test.camel.context.name=test-value

You could also set the value manually to what the artifactId of the project is (this is what Quarkus defaults to).

Not, exactly dev mode not work

./gradlew quarkusDev

It is stated in reproduction flow.

I can provide simple test project.

Then that is new. Yes please create a sample project and attach it to the issue.

cc @aloubyansky who has done a lot of Gradle work lately

Sample project. Generated from Starter, removed irrelevant REST resource and added Camel route.

9177.zip

Thanks a lot for the reproducer. Bad news, looks like with master it's getting even worse
````

Task :quarkusBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':quarkusBuild'.
    > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 4 deployment problems:
    [1] Unsatisfied dependency for type io.quarkus.scheduler.runtime.SchedulerRuntimeConfig and qualifiers [@Default]
    - java member: io.quarkus.quartz.runtime.QuartzScheduler#()
    - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzScheduler, io.quarkus.scheduler.Scheduler], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzScheduler]
    [2] Unsatisfied dependency for type io.quarkus.quartz.runtime.QuartzRuntimeConfig and qualifiers [@Default]
    - java member: io.quarkus.quartz.runtime.QuartzSupport#()
    - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
    [3] Unsatisfied dependency for type io.quarkus.quartz.runtime.QuartzBuildTimeConfig and qualifiers [@Default]
    - java member: io.quarkus.quartz.runtime.QuartzSupport#()
    - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
    [4] Unsatisfied dependency for type java.util.Optional and qualifiers [@Default]
    - java member: io.quarkus.quartz.runtime.QuartzSupport#()
    - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
    at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:981)
    ``` quarkusDevandquarkusBuild` fail in the same way though.

This is an example of a major issue in our gradle app model resolver. This wouldn't happen in an equivalent Maven project. Although, I think it's a good opportunity to review both and come up with a single principle to version alignment.
The issue is the deployment dependencies aren't properly aligned.

Oh, once the version alignment is properly done, I'm seeing the original issue about the property not being found.

Was this page helpful?
0 / 5 - 0 ratings