takari / polyglot-maven

Support alternative markup for Apache Maven POM files
Eclipse Public License 1.0
890 stars 98 forks source link

[polyglot-groovy] Dependencies are not resolved via dependencyManagement from parent #107

Open eddumelendez opened 7 years ago

eddumelendez commented 7 years ago

In the pom.xml below, dependencies are resolved via parent so it isn't required to add version in the dependency section. Maven commands execution run ok.

<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

But, when pom.groovy is used the following exception is thrown.

[ERROR]   The project com.example:demo:0.0.1-SNAPSHOT (C:\Users\eddu.melendez\IdeaProjects\demo\.polyglot.pom.groovy) has 1 error
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing.

pom.groovy is:

project {
  modelVersion '4.0.0'
  parent {
    groupId 'org.springframework.boot'
    artifactId 'spring-boot-starter-parent'
    version '1.4.2.RELEASE'
    relativePath ''
  }
  groupId 'com.example'
  artifactId 'demo'
  version '0.0.1-SNAPSHOT'
  name 'demo'
  description 'Demo project for Spring Boot'

  properties {
    'project.reporting.outputEncoding' 'UTF-8'
    'java.version' '1.8'
    'project.build.sourceEncoding' 'UTF-8'
  }
  dependencies {
    dependency 'org.springframework.boot:spring-boot-starter-web'
    dependency {
      groupId 'org.springframework.boot'
      artifactId 'spring-boot-starter-test'
      scope 'test'
    }
  }

  build {
    plugins {
      plugin {
        groupId 'org.springframework.boot'
        artifactId 'spring-boot-maven-plugin'
      }
    }
  }
}
mosabua commented 7 years ago

I think you can not yet mix parent and child poms with different formats. Can you confirm @jdillon or @jvanzyl ?

mxmind commented 5 years ago

Hi @mosabua, I have the same issue, is it resolved?

mosabua commented 5 years ago

no