Deploy parent pom with ${revision} version

237 Views Asked by At

I have create a simple project with parent and child pom.xml files. The parent pom.xml

<?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.apache</groupId>
        <artifactId>apache</artifactId>
        <version>18</version>
    </parent>
    <groupId>org.apache.maven.ci</groupId>
    <artifactId>ci-parent</artifactId>
    <name>First CI Friendly</name>
    <version>${revision}</version>

    <properties>
        <revision>1.0.0-SNAPSHOT</revision>
    </properties>

    <distributionManagement>
        <repository>
            <id>central</id>
            <name>repo-releases</name>
            <url>https://repo.jfrog.io/artifactory/test</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>repo-artifactory-primary-1-snapshots</name>
            <url>https://repo.jfrog.io/artifactory/test-snapshot</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.1.0</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

And the pom.xml is like this:

<?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.apache.maven.ci</groupId>
        <artifactId>ci-parent</artifactId>
        <version>${revision}</version>
    </parent>
    <groupId>org.apache.maven.ci</groupId>
    <artifactId>ci-child</artifactId>
</project>

The parent deploy work fine, but I'm not be able to import the parent pom.xml from remote repo. I have an error like this:

[FATAL] Non-resolvable parent POM for org.apache.maven.ci:ci-child:${revision}: Could not transfer artifact org.apache.maven.ci:ci-parent:pom:${revision} from/to central (...): Authorization failed for .../remote-repos/org/apache/maven/ci/ci-parent/$%257Brevision%257D/ci-parent-$%257Brevision%257D.pom 403 Forbidden and 'parent.relativePath' points at wrong local POM @ line 6, column 13

How can set up my projects? Thanks.

0

There are 0 best solutions below