fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 642 forks source link

Follow settings ingored unless specified from command line #1797

Open jakub-bochenski opened 5 months ago

jakub-bochenski commented 5 months ago

Description

None of this works

            <properties>
                <docker.follow>true</docker.follow>
            </properties>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>io.fabric8</groupId>
                            <artifactId>docker-maven-plugin</artifactId>
                            <configuration>
                                <follow>true</follow>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>

the setting is only respected when specified from command line.

This is confusing. Also I can't have a nice mvn -Prun command working.

Info

rohanKanojia commented 5 months ago

@jakub-bochenski : Would it be possible for you to debug this? Could you please run mvnDebug docker:log and then set a breakpoint here and connect from your IDE as JVM debug

https://github.com/fabric8io/docker-maven-plugin/blob/ac5e09afa705ed819759fa81632e922368b7f6cb/src/main/java/io/fabric8/maven/docker/LogsMojo.java#L64

jakub-bochenski commented 4 days ago

I'm after the StartMojo, not LogsMojo

Looking at the code it becomes obvious that only a system property is supported and not maven configuration. But why? Can it be changed?

https://github.com/fabric8io/docker-maven-plugin/blob/v0.45.1/src/main/java/io/fabric8/maven/docker/StartMojo.java#L223

jakub-bochenski commented 4 days ago

This is the workaround I use for now

                    <plugin>
                        <!-- https://github.com/fabric8io/docker-maven-plugin/issues/1797 -->
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>set-system-properties</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <property>
                                            <name>docker.follow</name>
                                            <value>true</value>
                                        </property>
                                    </properties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>