Maven release process consistently failing : svn: E175013: Access to '/svn/tester/!svn/bc/170' forbidden - maven

I have been banging my head for quite a while now and I have actually learnt lots of this issues on stackoverflow an pretty sure I covered some of the common mistakes(besides,I have done several releases with bitbucket and github) that were starring at me. But still I have not been able to release anything. I feel like it's time to shout for a little help :)
I use a self hosted subversion managed by usvn and a sonatype private nexus repository. I have a multi module maven project arrange in a parent and sub module model.
Below is the snippet of the parent pom that is relevant
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<excludes>
<exclude>**/*ITest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding} </encoding>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>${project.build.sourceEncoding} </encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<preparationGoals>clean verify -DenableIT=true</preparationGoals>
<tagBase>https://repo.mysvnserver.com/svn/tester/tags</tagBase>
</configuration>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
<id>dal</id>
<url>http://nexus.mynexusserver.com/nexus/content/repositories/releases</url>
</repository>
</distributionManagement>
<scm>
<connection>scm:svn:https://username#repo.mysvnserver.com/svn/tester</connection>
<developerConnection>scm:svn:https://username#repo.mysvnserver.com/svn/tester</developerConnection>
<url>https://repo.mysvnserver.com/usvn/project/tester/browser</url>
<tag>tester</tag>
</scm>
Below is my settings.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<settings >
<localRepository>/home/joseph/.m2/repository</localRepository>
<servers>
<server>
<username>username</username>
<password>password</password>
<id>nexus</id>
</server>
<server>
<username>username</username>
<password>password</password>
<id>dal</id>
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://nexus.mynexusserver.com/nexus/content/repositories/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>dal</id>
<url>http://nexus.mynexusserver.com/nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
Since it would probably too much to put the output here , please find it on paste.ee .
I am more convince this is either configuration issue on subversion side because things looks fairly ok to me. Can anyone point out something I am missing?
Thanks

The SCM part of your POM looks not related to an actual SVN branch (or the trunk) of a project. For the SCM-linked part of the release plugin to work, I guess an SCM configuration closer to what is described in the SCM plugin should be made. A project POM SCM information should describe where to get the source code related to that exact project version, not the root project location.
I guess that without this, SVN can trigger unexpected authorization issues as you are in fact trying to access an URL where you might not have set permissions.

Related

In Maven 3.5.2, how do I use a profile defined in my settings.xml file in my pom.xml file?

Say I have the following profile defined in my ~/.m2/settings.xml file
<profiles>
<profile>
<id>artifactory</id>
</repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>thirdparty</id>
<name>scscm-thirdparty</name>
<url>http://www.mycompany.com/artifactory/my-thirdparty-repo</url>
</repository>
</repositories>
</profile>
</profiles>
Now I want to download a home-built apr-1.6.2.tar.gz arfifact from the thirdparty repository id defined in the settings.xml, so in my pom.xml file I have
<artifactId>apr</artifactId>
<groupId>com.company</groupId>
<version>1.6.2</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache</groupId>
<artifactId>apr</artifactId>
<version>1.6.2</version>
<type>tar.gz</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>apr</id>
<phase>pre-integration-test</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
# HOW DO I SPECIFY URL FROM PROFILE HERE????
<unpack>false</unpack>
</configuration>
</execution>
</executions>
</plugin>
</plujgins>
</build>
I see examples of profiles online, but they're all defined in the pom.xml itself, but that's not what I want to do. I just want to use a URL defined in my settings.xml profile inside my pom.xml file.
you can achieve this in multiple ways
Set active profile in Settings.xml
<profiles>
<profile>
<id>artifactory</id>
</repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>thirdparty</id>
<name>scscm-thirdparty</name>
<url>http://www.mycompany.com/artifactory/my-thirdparty-repo</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
Set active profile from CLI
mvn clean verify -P artifactory
set active profile as default in Settings.xml
<profiles>
<profile>
<id>artifactory</id>
</repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>thirdparty</id>
<name>scscm-thirdparty</name>
<url>http://www.mycompany.com/artifactory/my-thirdparty-repo</url>
</repository>
</repositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
For more info on these options check maven page
activate them via command-line (-P <name>) or with triggers what ever you like. but ask yourself, whether it is the right place to locate your profile. for further info look at the documentation:
1.Maven Doc
same question?
Profile activation in Eclipse

nexus-staging-maven-plugin 401 Unauthorized

I am getting a 401 Unauthorized exception from deploying the maven. Here is the relevant section of the pom file.
<!-- pom.xml -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>[version]</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<nexusUrl>[your-nexus-base-url]</nexusUrl>
<serverId>[your-nexus-base-id]</serverId>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>[your-nexus-base-url]/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>[your-nexus-base-url]/content/repositories/releases/</url>
</repository>
</distributionManagement>
<!-- settings.xml -->
<servers>
<server>
<id>[your-nexus-base-id]</id>
<username>[username]</username>
<password>[encrypted-password]</password>
</server>
</servers>
You must have an ID in your settings.xml file to match the ID under the distribution management. NOT ONLY the ID in the nexus plugin.
<!-- pom.xml -->
<distributionManagement>
<snapshotRepository>
<id>[your-nexus-base-id]</id>
<url>[your-nexus-base-url]/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>[your-nexus-base-id]</id>
<url>[your-nexus-base-url]/content/repositories/releases/</url>
</repository>
</distributionManagement>
<!-- settings.xml -->
<servers>
<server>
<id>[your-nexus-base-id]</id>
<username>[username]</username>
<password>[encrypted-password]</password>
</server>
</servers>

Sonar Squid Error while sonar analysis with jenkins job through maven

I am using jenkins for continous integration build process through maven and using sonar for code review as well. jenkins job is working fine for creating build but when sonar analysis starts, it throw below error..
[ERROR] [19:19:47.494] Squid Error occurs when analysing :D:\Jenkins_New\jobs\Sample_Maven_Project\workspace\src\main\java\software\bean\UserBean.java
org.sonar.squid.api.AnalysisException: The source directory does not correspond to the package declaration software.bean
"
I'm stucked in this issue.
below is my project pom.xml file
<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>nuc</groupId>
<artifactId>nuc</artifactId>
<version>0.1</version>
<packaging>war</packaging>
<name>nuc</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>neutrino-central-repository-Nexus</id>
<name>Neutrino Central Repository</name>
<url>http://10.1.50.56:9081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>neutrino-central-plugin-repository-Nexus</id>
<url>http://10.1.50.56:9081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>WebContent</directory>
<targetPath>/${project.build.directory}/${project.build.finalName}</targetPath>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>src/META-INF</directory>
<targetPath>/${project.build.directory}/META-INF</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<webXml>WebContent/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
This error means that the ".java" source files are not located in a correct folder.
If your project is a Maven project, chances are that the ".java" source files are located in <project>/src/main/java - like the convention suggests it.
However, from what I see in your POM, you have set the source folder to be "src" instead of "src/main/java". This is why you get this error.

How does maven default life cycle get executed on maven project

I have this very simple question in the context of maven. In the maven world, it says everything about my project is defined in the project object model.
So, when I put <packaging> element inside my project object model to be war etc, then maven will apply appropriate goals to default life cycle of maven.But to make it work, I have to define the project maven-war-plugin inside the build section of my project object model. But when I inspect my pom and super pom, it does not have maven-war-plugin included. I am using maven 3.0.5 and super pom is located inside
\maven-model-builder-3.0.5\org\apache\maven\model
following is the content of the super pom. So I'am confused here from where does it take this plugin if it is not described in the project object model. definition of pom says that everything about my project is defined inside the project object model. Could anybody help me here to understand the concept clearly. Thanks in advance for any help
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- START SNIPPET: superpom -->
<project>
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
<pluginManagement>
<!-- NOTE: These plugins will be removed from future versions of the super POM -->
<!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<outputDirectory>${project.build.directory}/site</outputDirectory>
</reporting>
<profiles>
<!-- NOTE: The release profile will be removed from future versions of the super POM -->
<profile>
<id>release-profile</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<inherited>true</inherited>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<inherited>true</inherited>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<!-- END SNIPPET: superpom -->
Take a look at the default-bindings.xml, particularly the definition for <role-hint>war</role-hint>:
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>war</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
...
<package>
org.apache.maven.plugins:maven-war-plugin:2.2:war
</package>
This defines what goal will be run for this packaging type's package phase by reference to the war-specific plugin.
This is covered by the Introduction to the Build Lifecycle in Built-in Lifecycle Bindings.

Maven update into local repository

I am trying to build a self extracting zip file and upload it to our Local Repository for which I have the below code snippet from my pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myCompany.management</groupId>
<artifactId>esm-parent-pom</artifactId>
<version>SNAPSHOT</version>
</parent>
<groupId>com.myCompany.management.atg</groupId>
<artifactId>XYZ_ABC_SM</artifactId>
<version>SNAPSHOT</version>
<packaging>pom</packaging>
<name>${artifactId}</name>
<scm>
<connection>scm:svn:http://scm.esm.myCompany.corp/svn/esm/trunk/build/smart-modules/XYZ_ABC_SM</connection>
<url>http://scm.esm.myCompany.corp/viewer/browse/esm/esm/trunk/build/smart-modules/XYZ_ABC_SM</url>
</scm>
<url>${urlBase}/${artifactId}/${version}</url>
<distributionManagement>
<site>
<id>esm-site</id>
<name>myCompany ESM Maven Site</name>
<url>${siteDistributionBase}/${artifactId}/${version}</url>
</site>
</distributionManagement>
<repositories>
<repository>
<id>esm-snapshot</id>
<name>myCompany ESM Snapshots</name>
<url>http://repo.esm.myCompany.corp/repo/esm-snapshot</url>
<snapshots>
<checksumPolicy>fail</checksumPolicy>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>myCompany-main-release</id>
<name>Factory Repository</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://repo.release.myCompany.corp/main/repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>esm-release</id>
<name>ESM Release Repository</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://repo.esm.myCompany.corp/repo/esm</url>
</pluginRepository>
<pluginRepository>
<id>myCompany-internal-release</id>
<name>Factory Internal Repository</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://repo.release.myCompany.corp/internal/repo</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<!-- Step 1: download Schema Files. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<!-- Gather Schema Files. -->
<artifactItem>
<groupId>com.myCompany.management</groupId>
<artifactId>management-oracle</artifactId>
<version>${project.version}</version>
<type>schema</type>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step2: Convert into a Self Extracting Exe File -->
<plugin>
<groupId>com.myCompany.build</groupId>
<artifactId>batch-plugin</artifactId>
<version>1.1.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>executebatch</goal>
</goals>
<configuration>
<batchfilename>BuildLINUX64.bat</batchfilename>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 4: Upload the newely build zip file out to our repository. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>attach headers</id>
<phase>install</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}\XYZ_ABC_SM.exe</file>
<type>exe</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Maven uploads it to the local repository only when phase is in package mode
but when I change it to install it does not get upload. Shouldn't that be the opposite?
I am using mvn install to run maven.

Resources