mvn release plugin releasing next snapshot not current release - maven

Hello I've been releasing a project from my workstation with no problems. I've recently tried releasing another project from 1.0.0-SNAPSHOT. However when it actually does the release it releases 1.0.1-SNAPSHOT to the snapshots repository instead of 1.0.0 to releases repository.
I've done dryRun=true and it seems fine. In fact it defaults me to the versions:
What is the release version for "Appname"? (...) 1.0.0: :
What is SCM release tag or label for "Appname"? (...) Appname-1.0.0: :
What is the new development version for "Appname"? (...) 1.0.1-SNAPSHOT: :
I take all the defaults.
However when i do the "mvn release:perform"
This is what it does:
[INFO] Uploading: http://{corporate-nexus-site}/snapshots/{app-path}/1.0.1-SNAPSHOT/fei-logging-formatter-1.0.1-20140929.153303-1.jar
...
[INFO] [INFO] BUILD SUCCESS
I'm using latest maven and i manually added latest release plugin. And I can release another project using same parent and settings.xml setup.
Looking at the properties file after a dryrun and prepare it all looks right to me.
I thought originally i had my distribution set up wrong, and was releasing a release to the snapshot repository, but as you can see its actually thinking its doing a good job and releasing a snapshot.
confused royally.
Any ideas on what to try?
thanks.
UPDATE: In the project I updated the pom from 1.0.0-SNAPSHOT to 1.0.0 and did a "mvn deploy" and it put it exactly where I expected in releases, without out all the goodies of course.
UPDATE2: Pom (company name to protect the guilty)
<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>logging-formatter</groupId>
<artifactId>logging-formatter</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Logging Formatter</name>
<description>logging tool to format your logging in the standard cn way.</description>
<parent>
<groupId>com.companyname.pom.parent.master</groupId>
<artifactId>cn-pom-parent-master</artifactId>
<version>2014.3.0</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
</build>
<scm>
<url>http://svn.sys.ds.companyname.com/svn/cn-logging</url>
<connection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</connection>
<developerConnection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</developerConnection>
</scm>
<organization>
<name>CompanyName Enterprises</name>
</organization>
<ciManagement>
<system>Jenkins</system>
<url>http://jenkins.sys.ds.companyname.com:8080/job/cn-logging-DEVELOP/</url>
</ciManagement>
</project>
UPDATE3: Adding parent settings info
SETTINGS.XML
<repositories>
<repository>
<id>fei-releases</id>
<name>Ferguson Release Repository</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://{companyname}/nexus/content/repositories/releases</url>
<layout>default</layout>
</repository>
<repository>
<id>fei-snapshots</id>
<name>Ferguson Snapshot Repository</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://{companyname}/nexus/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
<repository>
<id>fei-thirdparty</id>
<name>Ferguson 3rd Party Repository</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://{companyname}/nexus/content/repositories/thirdparty/</url>
<layout>default</layout>
</repository>
</repositories>
PARENT REPOSITORIES:
<repositories>
<repository>
<id>third-party</id>
<name>3rd Party Repository</name>
<url>http://{companyname}/nexus/content/repositories/thirdparty/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories/>
PARENT DISTRIBUTION MANAGEMENT:
<distributionManagement>
<repository>
<id>fei-releases</id>
<name>Ferguson Release Repository</name>
<url>http://{companyname}/nexus/content/repositories/releases</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<id>fei-snapshots</id>
<name>Ferguson Snapshot Repository</name>
<url>http://{companyname}/nexus/content/repositories/snapshots</url>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>

i did a "mvn release:clean release:prepare" then a "mvn
release:perform" Same steps I used to release another project without
issue using the same parent.
So you have another project that is deployed fine after release? (you see the release version in the repo)?
If so, it sounds like an issue in your 'problematic' project. Can you share its pom.xml?

#SteveHolt,
I see a red flag in your pom.xml file:
<scm>
<url>http://svn.sys.ds.companyname.com/svn/cn-logging</url>
<connection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</connection>
<developerConnection>scm:svn:http://svn.sys.ds.companyname.com/svn/cn-logging</developerConnection>
</scm>
None of these urls contain the trunk, branches, or tags keywords.
Consequently, when Maven creates the release tag, it tells SVN to use the same url as before:
http://svn.sys.ds.companyname.com/svn/cn-logging
When release-prepare runs, it performs
$ svn checkout http://svn.sys.ds.companyname.com/svn/cn-logging/
but it can't tell apart the release tag from the development trunk.
Therefore it retrieves the post-release snapshot revision (which is the latest commit) rather than the release revision (the preceding commit).
Solution:
Create a trunk dir under cn-logging and move all your code into it:
svn/cn-logging/
trunk/
pom.xml
src/
main/
java/
branches/
tags/
Hope that helps.

Related

How to prevent Maven from downloading artifacts from repository when I just update the pom version of my project

I'm using Maven as CI and JFrog Artifactory as a repository of my own artifacts and as a cache. Everything works fine. I'm using the Artifactory plugin in Jenkins to trigger artifact download and upload.
I cannot figure how to handle the following use case.
I have a multi-module project. In my Settings.xml I defined some snapshot, plugin, and release repositories.
In my local workspace, I upgraded the pom version of the parent project and its children. Then I made a local clean install. It failed because Maven was trying to download the artifacts of my project from Artifactory and they don't exist of course because I'm trying to create a new version of the project.
How to handle this use case? How to configure my pom or settings to do?
How to do this in the Artifactory plugin in Jenkins in a freestyle way?
I have error messages like this :
10:23:28 Failed to transfer Could not find metadata com.xxx.xxxx.xxx:my-parent-project:3.0.0-SNAPSHOT/maven-metadata.xml in xxx
10:23:50 [FATAL] Non-resolvable parent POM for com.xxx.xxxx.xxx:subpoject1:[unknown-version]: Could not find artifact .....and 'parent.relativePath' points at wrong local POM # line 7, column 10*
=====================================
pom configuration of the parent pom
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>my-parent-project</artifactId>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../subproject-1</module>
<module>../subproject-2</module>
</modules>
==================================
pom configuration for subproject1
<artifactId>subproject-1</artifactId>
<parent>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>my-parent-project</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
======================================
Here is my settings.xml configuration
<profile>
<id>artifactory_profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/libs-snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>sing</id>
<name>sing-virtual-repo</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/virtual-repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-release</name>
<url>http://xxxxxxxxxxxx:8081/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
</profile>
If you run clean install on the parent POM, then everything will be created correctly.

3rdparty repository issues with maven pom.xml

I was looking for BIRT Dependency in the net. Package my code refers are
import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.attribute.Anchor;
It is using chartengineapi and below is the maven dependency entry for POM.
<!-- https://mvnrepository.com/artifact/org.eclipse.birt/chartengineapi -->
<dependency>
<groupId>org.eclipse.birt</groupId>
<artifactId>chartengineapi</artifactId>
<version>2.3.2</version>
</dependency>
Since it is part of other repository (https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/) it gives error in Pom.xml. Could any one help me to sort out this ?
added repository tag and resolved.
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
Add one more <repository></repository> and the give the new repo name and link. It worked for me though I am not sure whether this is a standard approach.

Could not find artifact org.wildfly:wildfly-parent:jar:10.0.0.Final. Where is it?

I'm trying to add server module dependencies for wildfly 10.0.0 Final in my pom but I can't find a a working repository.
I have this in my pom:
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-parent</artifactId>
<version>10.0.0.Final</version>
</dependency>
and I tried to add the jboss repository:
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
and what I get is this:
Could not find artifact org.wildfly:wildfly-parent:jar:10.0.0.Final in jboss-public-repository-group (http://repository.jboss.org/nexus/content/groups/public/
I checked the repository. The pom is actually there but the jar at:
http://repository.jboss.org/nexus/content/groups/public/org/wildfly/wildfly-parent/10.0.0.Final/wildfly-parent-10.0.0.Final.jar
is not.
Which repository should I add?

Cannot download "internal" SNAPSHOT artefacts from Apache archiva

I am using maven 3.0 and Apache Archiva as remote internal repository (configured as mirrior in settings.xml) but I am having problems downloading SNAPSHOT artifacts.
Failed to execute goal on project IntegrationTests: Could not resolve dependencies for project com.br.bigdata:IntegrationTests:jar:1.0-SNAPSHOT: Could not find artifact com.br.bigdata:HBaseSchema:jar:1.0-SNAPSHOT in archiva.default (.../archiva/repository/internal/) -> [Help 1]
I checked similar posts here but couldn't resolve my problem.
I checked the Archiva repository, artifact is present, correct pom versions etc.
In my pom the dependency is specified:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>HBaseSchema</artifactId>
<version>${version.hbaseSchema}</version>
<scope>test</scope>
</dependency>
The artifact pom:
<groupId>com.br.bigdata</groupId>
<artifactId>HBaseSchema</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HBaseSchema</name>
<description>Logical HBase schema</description>
Sorted. This needs to be added to settings.xml
<mirror>
<id>archiva.snapshots</id>
<url>http://localhost:8080/archiva/repository/snapshots</url>
<mirrorOf>snapshots</mirrorOf>
</mirror>
and
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>https://lab-insighttc:8080/archiva/repository/internal</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>Archiva Managed Internal Repository</name>
<url>https://lab-insighttc:8080/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>

Snaphot repository issue

We have installed Archiva with the two repositories set by default.
Here is my settings.xml:
<server>
<id>mycompany-release</id>
<username>admin</username>
<password>******</password>
</server>
<server>
<id>mycompany-snapshots</id>
<username>admin</username>
<password>******</password>
</server>
<mirror>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
<mirrorOf>external:*</mirrorOf>
</mirror>
<mirror>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
<mirrorOf>apache.snapshots</mirrorOf>
</mirror>
<profile>
<id>repo</id>
<repositories>
<repository>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<activeProfiles>
<activeProfile>repo</activeProfile>
</activeProfiles>
I have a parent project that I use to set the common configuration for all the projects. The version of this parent project is 1-SNAPSHOT. So, in all the other projects, the parent section points to this parent project with version 1-SNAPSHOT (without relative path element). If I deploy my parent project to the archiva repository, it is there. If I try to run any command on another project, as mvn clean, it works since the parent project was installed during deployment. But, if I delete manually the parent project from my local repository and try to run the same command, Maven returns an error saying :
Non resolvable parent POM: Could not find artifact
com.mycompany:Parent:pom:1-SNAPSHOT in mycompany-release
(http://X.X.X.X:8080/archiva/repository/internal/) and
'parent.relativePath' points at wrong local POM
It seems that the parent project is looked up in the release repository while I expected it's looked up in the snapshot repository.
Thanks for your help
EDIT: Here is one part of the child POM:
<parent>
<groupId>com.mycompany</groupId>
<artifactId>Parent</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>child</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
If I remove the parent section and run mvn help:effective-pom, I get (only repositories is shown):
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mycompany-release</id>
<url>http://X.X.X.X:8080/archiva/repository/internal/</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>mycompany-snapshots</id>
<url>http://X.X.X.X:8080/archiva/repository/snapshots/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
NOTE: if I replace the parent version by 1 (instead of 1-SNAPSHOT), it works.
I found what was the issue. The problematic line in the settings.xml is:
<mirrorOf>external:*</mirrorOf>
Indeed, it caused Maven to consider the mycompany-release repository as a mirror of mycompany-snapshots repository. But, this repository doesn't mirror snapshots. I replaced this line by:
<mirrorOf>central</mirrorOf>
Now, the mycompany-release repository mirror only the Maven central repository and not the mycompany-snapshots repository, so it looks up the snapshots artifacts in the mycompany-snapshots repository.
Thanks Andrew for your help! I didn't now there was a possibility to display the full log.

Resources