spring-projects-experimental / spring-boot-thin-launcher

Tools for building "thin" executable jars, with a focus on, but not exclusively for, Spring Boot
https://github.com/dsyer/spring-boot-thin-launcher
Apache License 2.0
681 stars 90 forks source link

Cannot resolve dependency with version property #36

Closed ascheman closed 7 years ago

ascheman commented 7 years ago

I encounter the following error

[ERROR] 'build.plugins.plugin[org.springframework.boot:spring-boot-maven-plugin].dependencies.dependency.version' for org.springframework.boot.experimental:spring-boot-thin-layout:jar must be a valid version but is '${spring-boot-thin-maven-plugin.version}'. @ org.dukecon:dukecon-server-springboot:[unknown-version], URL [jar:file:/Users/ascheman/wrk/dukecon/dukecon_server/impl/target/dukecon-server-springboot-1.4-SNAPSHOT.jar!/META-INF/maven/org.dukecon/dukecon-server-springboot/pom.xml], line 669, column 22

The POM contains the following block (lines 660 - 671)

      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.springframework.boot.experimental</groupId>
            <artifactId>spring-boot-thin-layout</artifactId>
            <!-- For some reason spring-boot-thin-maven-plugin or the embedded artifact resolver cannot use a version property here -->
            <!--<version>1.0.7.BUILD-SNAPSHOT</version>-->
            <version>${spring-boot-thin-maven-plugin.version}</version>
          </dependency>
        </dependencies>

As you can see from the comment everything is fine if I replace the version property with a real value.

dsyer commented 7 years ago

Well, you have to define the spring-boot-thin-maven-plugin.version property, if you are going to refer to it in your plugin config. Did you just forget to do that?

ascheman commented 7 years ago

I do have a multi module project. The main (top level) POM is the reactor and the parent to all modules. I define all properties globally in the parent pom to share them among all modules. Probably this leads to the error? Unfortunately one has to compute the full effective POM to resolve the property (which even Maven or some plugins do not do in any case where it is necessary).

dsyer commented 7 years ago

Can you share a simple sample?

ascheman commented 7 years ago

You will find our project here: https://github.com/dukecon/dukecon_server (check out the develop branch). I have not yet pushed the branch with the thin launcher but can do that if necessary after some small clean up during the day. If you need a simpler example I can compile one based on your examples during the next days.

dsyer commented 7 years ago

Thanks for the link. A more minimal project that I can use to reproduce the issue would be better. No rush.

dsyer commented 7 years ago

I can't reproduce this problem without more detail. A simple parent child maven project works for me (https://github.com/scratches/thin-demo-parent).