java - Maven: Downloading a parent pom from the repository deletes repositories tag -
i have parent-pom stored on remote artifactory repository. parent-pom defines <repositories>
tag snapshot repositories contain parent of parent-pom.
when try build project using parent-pom, maven correctly finds parent-pom in artifactory repository , downloads it.
during build process snapshot dependencies can't found however, since parent-pom ends in local repository missing <repositories>
tag.
it works fine if run mvn clean install
in directory of parent-pom install locally, downloading repository seems rid of tag.
this seems me bug, maybe i'm missing , intended behaviour? if so, why? there workaround can use make possible define repositories in parent-pom?
parent-pom stored on artifactory server:
<?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> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.0.m2</version> </parent> <modelversion>4.0.0</modelversion> <groupid>com.example</groupid> <artifactid>example-parent</artifactid> <version>1.0.1</version> <packaging>pom</packaging> <name>example-parent</name> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <java.version>1.8</java.version> </properties> <dependencymanagement> <dependencies> <dependency> <groupid>com.example</groupid> <artifactid>example-project</artifactid> <version>0.0.1-snapshot</version> </dependency> </dependencies> </dependencymanagement> <repositories> <repository> <id>spring-snapshots</id> <name>spring snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>spring-milestones</id> <name>spring milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginrepositories> <pluginrepository> <id>spring-snapshots</id> <name>spring snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </pluginrepository> <pluginrepository> <id>spring-milestones</id> <name>spring milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginrepository> </pluginrepositories> <distributionmanagement> <repository> <id>example-releases</id> <name>example-releases</name> <url>http://com.example/blabla</url> </repository> <snapshotrepository> <id>example-snapshots</id> <name>example-snapshots</name> <url>http://com.example/blabla</url> </snapshotrepository> </distributionmanagement> </project>
parent-pom downloaded repository when building child project:
<?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> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.0.m2</version> </parent> <modelversion>4.0.0</modelversion> <groupid>com.example</groupid> <artifactid>example-parent</artifactid> <version>1.0.1</version> <packaging>pom</packaging> <name>example-parent</name> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <java.version>1.8</java.version> </properties> <dependencymanagement> <dependencies> <dependency> <groupid>com.example</groupid> <artifactid>example-project</artifactid> <version>0.0.1-snapshot</version> </dependency> </dependencies> </dependencymanagement> <distributionmanagement> <repository> <id>example-releases</id> <name>example-releases</name> <url>http://com.example/blabla</url> </repository> <snapshotrepository> <id>example-snapshots</id> <name>example-snapshots</name> <url>http://com.example/blabla</url> </snapshotrepository> </distributionmanagement> </project>
(even including whitespace tags used be)
artifctory may filter out repository tags under circumstances, see [rtfact-5343] artifactory removes pom <repositories> tag when accessing virtual repository:
this feature of artifactory make sure maven work against artifactory server.
once maven encounter repository tag inside pom try download dependencies repositories, shortcutting repository manager. file self saved un touched inside repository.
you can turn off in virtual repository config panel http://wiki.jfrog.org/confluence/display/rtf/virtual+repositories
Comments
Post a Comment