repaint-io / maven-tiles

Injecting maven configurations by composition rather than inheritance
154 stars 32 forks source link

mixin fails on spring boot projects #25

Closed jskjons closed 8 years ago

jskjons commented 9 years ago

I'm attempting to use this plugin on a spring boot project and I'm getting this exception when it runs:

org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalArgumentException: no model resolver provided, cannot resolve parent POM org.springframework.data.build:spring-data-build:1.5.2.RELEASE for POM org.springframework.data:spring-data-releasetrain:Evans-SR2

A similar issue seems to have been ran into by another plugin doing some different maven hackery:

https://jira.codehaus.org/browse/MOJO-2032

Some comments on that issue seem to indicate the issue is related to the scope=import dependencies in the dependencyManagement section of spring-boot-dependencies.

rvowles commented 9 years ago

Thats entirely possible, Spring's use of Maven remains an abomination however, its an abomination that should still work. It could be that the Maven Model Merge doesn't support it, but it is easy enough to check.

jskjons commented 9 years ago

Here's an example pom that will repro the issue:

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.2.RELEASE</version>
    </parent>
    <artifactId>mixin-testing</artifactId>
    <groupId>mixin.testing</groupId>
    <name>Spring Boot Simple Sample</name>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</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>
            <plugin>
                <groupId>io.repaint.maven</groupId>
                <artifactId>tiles-maven-plugin</artifactId>
                <version>1.8</version>
                <extensions>true</extensions>
                <configuration>
                    <filtering>false</filtering>
                    <tiles>
                    <tile>it.session.maven.tiles:session-license-tile:0.8</tile>
                    </tiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
code-and-such commented 9 years ago

Is this pom a child of another pom (which is not it's parent)? This was the case for me, and I got the exact same error.

Anyway, I resolved the error by adding child element to the parent element.

EDIT: Still failing.

talios commented 9 years ago

I believe the 1.8 version of the plugin doesn't like tiles in children, this is fixed in HEAD@master - and that also prevents including the tile plugin in the parent/pom as well ( and also changes how the tiles are published ( it actually attaches them properly ) ).

akanter commented 9 years ago

I'm seeing a similar issue with a different <scope>import</scope> artifact (homegrown) using maven-tiles 2.2.

Caused by: java.lang.IllegalArgumentException: no model resolver provided, cannot resolve parent POM com.internal.hadoop.elephant-plug:elephant-plug:1.1.0 for POM com.internal.hadoop.elephant-plug:hadoop-bom:[unknown-version]

I've tried putting it in both the parent pom where that dependency is declared and also in child package and I get the same errors. Any guidance here or even idea of how it might be fixed via PR?

talios commented 9 years ago

@akanter are you able to put that in a reproducible public repo anywhere?

rvowles commented 8 years ago

thats a pretty spectacular stack trace.

rvowles commented 8 years ago

found it. fix coming.