quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Allow to add specific dependency in dev mode

Open apupier opened this issue 2 years ago • 6 comments

Description

For context, I would like to add camel-quarkus-debug dependency automatically as it allows automatic configuration of Camel Route Debugging capabilities. Currently the way (the workaround) is to have a specific profile with this dependency that I specify when launching dev mode. It gives something like: mvn quarkus:dev -Pcamel.debug and a specific profile just for the debug inside the pom.xml

For reference: https://github.com/apache/camel-quarkus/issues/3876

advantages:

  • No need to modify the pom.xml

drawbacks:

  • pollution of classpath. The dev mode has more differences than what we will have in production

discussion started on Zulip: https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Adding.20a.20specific.20dependency.20only.20in.20dev.20mode/near/366074605

Implementation ideas

something like: mvn quarkus:dev -Dquarkus.dev.extras=camel-quarkus-debug that is automatically adding the dependency.

apupier avatar Jun 20 '23 07:06 apupier

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip

This message is automatically generated by a bot.

quarkus-bot[bot] avatar Jun 20 '23 07:06 quarkus-bot[bot]

Will it cover transitive dependencies or the dependencies must be added manually to the command?

I mean, camel-quarkus-debug depends on camel-quarkus-management, will we need to add both to the command or only camel-quarkus-debug ?

essobedo avatar Jun 20 '23 09:06 essobedo

Iit should include transitive dependencies

apupier avatar Jun 20 '23 09:06 apupier

Subscribe.

Context: we have "forever" had developer tooling in Vaadin apps. Like in the description, we have been handling that with a profile (or technically, we have had them there by default and then instructed people to use "production" profile). Especially for new users without previous Vaadin experience, this is a PITA and they usually fail doing a proper deployment. Quickly skimming through the description, this would be great for Vaadin to "do things right".

With Spring Boot I recently created a PoC by adding a separate main method to src/test/java (like the suggest to do with Testcontainers if used for dev mode db configuration). This kind of leaks some class path entries not relevant for dev mode (but technically only for testing), but so far in my tests that also work pretty well. I wonder if that kind of compromise is possible with Quarkus.

Edit: Adding potential idea to implement the compromise, didn't test but guessing it might work like with SB. Explicitly defined main method to src/test/java. https://quarkus.io/guides/lifecycle#the-main-method

mstahv avatar Jul 12 '24 15:07 mstahv

Unless I'm mistaken about your exact use case, quarkus supports that:

https://quarkus.io/guides/gradle-tooling#dev-mode

I use that to configure different smallrye-reactive-massaging providers

# gradle kotlin dsl
dependencies {
    implementation("io.quarkus:quarkus-smallrye-reactive-messaging-kafka")
    quarkusDev("io.quarkus:quarkus-smallrye-reactive-messaging-mqtt")
    testImplementation("io.quarkus:quarkus-smallrye-reactive-messaging-mqtt")
}

lordvlad avatar Sep 30 '24 09:09 lordvlad

I've managed to make it work with some hack in the maven POM config file.

First of all, I had to set a custom profile with the desired dependencies:

    <profile>
        <id>local</id>
        <activation>
            <property>
                <name>env</name>
                <value>local</value>
            </property>
        </activation>
        <dependencies>
            <dependency>
                <groupId>my-group</groupId>
                <artifactId>my-dependency</artifactId>
            </dependency>
        </dependencies>
    </profile>

Then, I had to run the dev mode using mvn command and the custom property: mvn quarkus:dev -Denv=local

Unfortunately, it didn't work using the profile instead: mvn quarkus:dev -P local

Neither I could make it work using the quarkus dev mode inside IntellyJ IDEA.

jciombalo avatar Jun 16 '25 18:06 jciombalo