Search code examples
mavenintellij-ideapluginsswaggeropenapi-generator

Can not resolve ${project.parent.version} to download dependency


i am using/tried with following versions:

  • Intellij 2022.3.3 and the prev. one.
  • Maven 3.8.5, 3.8.4, 3.8.1

I also tried following envs:

  • Maven-Tool integrated into IntelliJ
  • IntelliJ terminal
  • OS terminal

And i always get this error:

[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available

Could not find artifact io.swagger:swagger-annotations:pom:${project.parent.version} in mirror-maven.

[INFO]
[INFO] --- openapi-generator-maven-plugin:5.1.0:generate (generate) @ XXX-parent-application ---
[WARNING] The POM for io.swagger.core.v3:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.core.v3:swagger-models:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v2-converter:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v3:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for org.openapitools:openapi-generator-core:jar:${project.parent.version} is missing, no dependency information available

[INFO] --- swagger-maven-plugin:3.1.8:generate (default) @ XXX-projectname ---
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-core:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-jaxrs:jar:${project.parent.version} is missing, no dependency information available

URL_TO_MY_CENTRAL_REPO/io/swagger/core/v3/swagger-annotations/$%7Bproject.parent.version%7D/swagger-annotations-$%7Bproject.parent.version%7D.pom

I am the only one in my team who has this issue, we checked a lot of stuff:

  • delete maven-repo-folder
  • check maven-configuration in intellij and settings.xml
  • insert a static version (but it does not overwrite ${project.parent.version}
  • yes, it does exist on our artifactory-server
  • fresh pull from github

So, my question is, where can i find this used property, because i cant find it anywhere in the project.

Update: added pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>PARENT</artifactId>
        <groupId>GROUP_ID_APP</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <modules>
        <module>application-a</module>
        <module>application-b</module>
        <module>application-c</module>
        <module>application-d</module>
    </modules>


    <artifactId>PARENT-application</artifactId>
    <packaging>pom</packaging>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>

        <!--Properties for swagger generating-->
        <swaggerJsonDir>${basedir}/target/generated</swaggerJsonDir>
        <swaggerJsonVersion>${project.version}</swaggerJsonVersion>
        <swaggerLocation>Override in child project</swaggerLocation>
        <swaggerTitle>Override in child project</swaggerTitle>
        <!--Override in child project with "compile"-->
        <swaggerPhase>none</swaggerPhase>

        <!--Properties for client generation-->
        <client-generation-application-package>Override in child project</client-generation-application-package>
        <sonar.exclusions>
            **/foldername/**/*_generated/**/*.java
        </sonar.exclusions>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- START: added this part below to check if this may solve my problem -->
        <!--        <dependency>-->
        <!--            <groupId>io.swagger</groupId>-->
        <!--            <artifactId>swagger-core</artifactId>-->
        <!--            <version>1.6.5</version>-->
        <!--        </dependency>-->

        <!-- 2.1.23 -->
        <!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-models -->
        <!--        <dependency>-->
        <!--            <groupId>io.swagger.core.v3</groupId>-->
        <!--            <artifactId>swagger-models</artifactId>-->
        <!--            <version>2.1.13</version>-->
        <!--        </dependency>-->
        <dependency>
            <groupId>io.swagger.parser.v3</groupId>
            <artifactId>swagger-parser</artifactId>
            <version>2.0.30</version>
        </dependency>

        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>openapi-generator-maven-plugin</artifactId>
            <version>5.4.0</version>
        </dependency>
        <!-- END: added this part above to check if this may solve my problem -->

    </dependencies>

    <build>
        <plugins>
            <!--Build executable jar from spring application.-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>

            <!--Generate swagger.json-->
            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>3.1.8</version>
                <configuration>
                    <apiSources>
                        <apiSource>
                            <springmvc>true</springmvc>
                            <locations>
                                <location>${swaggerLocation}</location>
                            </locations>
                            <info>
                                <title>${swaggerTitle}</title>
                                <version>${swaggerJsonVersion}</version>
                            </info>
                            <outputFormats>json</outputFormats>
                            <swaggerDirectory>${swaggerJsonDir}</swaggerDirectory>
                        </apiSource>
                    </apiSources>
                </configuration>
                <executions>
                    <execution>
                        <phase>${swaggerPhase}</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.3.1</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>generate-application-b-client</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
                <input>${project.basedir}/../application-b/target/generated/swagger.json</input>
                <targetDirectory>${project.basedir}/target/application-b</targetDirectory>
                <modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.model</modelPackage>
                <apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.service.client</apiPackage>
                <sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
                <modelDirectory>${sourceDirectory}/application_b_generated/model</modelDirectory>
                <apiDirectory>${sourceDirectory}/application_b_generated/service</apiDirectory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openapitools</groupId>
                        <artifactId>openapi-generator-maven-plugin</artifactId>
                        <version>5.1.0</version>
                        <executions>
                            <execution>
                                <id>generate</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <configuration>
                                    <inputSpec>${input}</inputSpec>
                                    <output>${targetDirectory}</output>
                                    <skipValidateSpec>true</skipValidateSpec>
                                    <generatorName>java</generatorName>
                                    <modelPackage>${modelPackage}</modelPackage>
                                    <apiPackage>${apiPackage}</apiPackage>
                                    <typeMappings>
                                        <typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
                                    </typeMappings>
                                    <importMappings>
                                        <importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
                                    </importMappings>
                                    <configOptions>
                                        <modelPackage>${modelPackage}</modelPackage>
                                        <apiPackage>${apiPackage}</apiPackage>
                                        <dateLibrary>java8</dateLibrary>
                                        <java8>true</java8>
                                        <library>resttemplate</library>
                                    </configOptions>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.0.2</version>
                        <executions>
                            <execution>
                                <id>copy-models</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${modelDirectory}</outputDirectory>
                                    <overwrite>true</overwrite>
                                    <resources>
                                        <resource>
                                            <directory>${targetDirectory}/${modelDirectory}</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>

                            <execution>
                                <id>copy-services</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${apiDirectory}</outputDirectory>
                                    <overwrite>true</overwrite>
                                    <resources>
                                        <resource>
                                            <directory>${targetDirectory}/${apiDirectory}</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>2.5</version>
                        <executions>
                            <execution>
                                <id>clean-old</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>${modelDirectory}</directory>
                                        </fileset>
                                        <fileset>
                                            <directory>${apiDirectory}</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                            <execution>
                                <id>auto-clean</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>${targetDirectory}</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
        <profile>
            <id>generate-application-a-client</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
                <input>${project.basedir}/../application-a/target/generated/swagger.json</input>
                <targetDirectory>${project.basedir}/target/application-a</targetDirectory>
                <modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.model</modelPackage>
                <apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.service.client</apiPackage>
                <sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
                <modelDirectory>${sourceDirectory}/application_a_generated/model</modelDirectory>
                <apiDirectory>${sourceDirectory}/application_a_generated/service</apiDirectory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openapitools</groupId>
                        <artifactId>openapi-generator-maven-plugin</artifactId>
                        <version>5.1.0</version>
                        <executions>
                            <execution>
                                <id>generate</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <configuration>
                                    <inputSpec>${input}</inputSpec>
                                    <output>${targetDirectory}</output>
                                    <skipValidateSpec>true</skipValidateSpec>
                                    <generatorName>java</generatorName>
                                    <modelPackage>${modelPackage}</modelPackage>
                                    <apiPackage>${apiPackage}</apiPackage>
                                    <typeMappings>
                                        <typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
                                    </typeMappings>
                                    <importMappings>
                                        <importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
                                    </importMappings>
                                    <configOptions>
                                        <modelPackage>${modelPackage}</modelPackage>
                                        <apiPackage>${apiPackage}</apiPackage>
                                        <dateLibrary>java8</dateLibrary>
                                        <java8>true</java8>
                                        <library>resttemplate</library>
                                    </configOptions>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.0.2</version>
                        <executions>
                            <execution>
                                <id>copy-models</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${modelDirectory}</outputDirectory>
                                    <overwrite>true</overwrite>
                                    <resources>
                                        <resource>
                                            <directory>${targetDirectory}/${modelDirectory}</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>

                            <execution>
                                <id>copy-services</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${apiDirectory}</outputDirectory>
                                    <overwrite>true</overwrite>
                                    <resources>
                                        <resource>
                                            <directory>${targetDirectory}/${apiDirectory}</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>2.5</version>
                        <executions>
                            <execution>
                                <id>clean-old</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>${modelDirectory}</directory>
                                        </fileset>
                                        <fileset>
                                            <directory>${apiDirectory}</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                            <execution>
                                <id>auto-clean</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>${targetDirectory}</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

</project>

Solution

  • Maven often doesn't resolve version number for transitive dependencies - "${project.version}"

    ill post my solution there.