maven release without scm/vcs - maven

I want to build a release version of my spring application with maven without the use of scm or ANY OTHER version control system - All I want is to build an application ready to be served via tomcat. While this sounds simple, it seems impossible for me to achieve.
I already tried options like suppressCommitBeforeTag / remoteTagging / pushChanges / dryRun directly via the command line
mvn -DremoteTagging=false -DsuppressCommitBeforeTag=true -DpushChanges=false release:prepare or by setting inside the pom.xml in the corresponding plugin configuration.
No matter what I do, I always get
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare
(default-cli) on project eStore: Missing required setting: scm
connection or developerConnection must be specified.
How can I completely deactivate version control / remote tagging when releasing?

Related

Dependencies outside of Apache NiFi must not use SNAPSHOT versions

I'm new to NiFi and I'm trying to develop my first custom processor.
I'm following documentation(s)/tutorial(s) on how to create one, and here I am:
generated maven skeleton project for nifi-processor; (✔)
added some simple implementation in the onTrigger(...) method; (✔)
failing to build .nar. (x)
Whenever I'm executing mvn clean package either within any sub-directory of the custom processor project structure (nifi-artifactBaseName-nar or nifi-artifactBaseName-processors) or in the root directory of the project, I get this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce (enforce-maven-version) on project nifi-myfirstcustomrprocessor-nar:
[ERROR] Rule 3: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps failed with message:
[ERROR] Dependencies outside of Apache NiFi must not use SNAPSHOT versions
[ERROR] com.giorgi.tutorials:nifi-myfirstcustomrprocessor-nar:nar:1.0-SNAPSHOT
[ERROR] com.giorgi.tutorials:nifi-myfirstcustomrprocessor-processors:jar:1.0-SNAPSHOT <--- is not a release dependency
Anything I'm doing wrong? any help?
Solved.
When creating a custom processor project (or just any maven project), version 1.0-SNAPSHOT is generated by default (disregarding of whether you create it from command-line, IDE, or etc.), and that's NOT OK for NiFi custom processor - you should NOT use SNAPSHOT for versioning your custom processor artifact.
I just changed 1.0-SNAPSHOT to 1.0 and everything worked fine - .nar has been built.

Why add a distribution management in POM if Jenkins already knows about it

Pretty much what the title say.
I am trying to build a CI/CD for WSO2. While following this tutorial:
https://docs.wso2.com/display/IntegrationCloud/Implement+Continuous+Integration+and+Deployment+with+Jenkins
It don't say anything about adding a DistributionManagement on the POM and it even has a special POM configuration section, but nevertheless, jenkins is throwing a
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project HelloWorld: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
So, if jenkins already has the repo URL, the branch and the github, and the POM has a deploy goal that should deploy to a URL:
1) why do I need the Distribution Management?
2) Can I point it to any location like my file system or do I have to point it to the cloud I actually want to deploy to?
according to maven documentation you can upload your build artifact directly to a server with maven using the tag distributionManagement
https://maven.apache.org/pom.html
the important part is the url tag. you can use scp or sftp (maybe other protocols)
scp://user:password#serverUrl/var/some/directory
I would recommend to test locally the command deploy and when you are sure it works, use jenkins.
If you want to make a state of the art jenkins job, I would recommend to use jenkins pipeline, execute maven with sh command and publish to a server using ssh steps provided by ssh-steps-plugin

how to automatically set scm connection in maven pom?

We are trying to run release:prepare but this produces error like below.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:
prepare (default-cli) on project test-module:
Missing required setting:
scm connection or developerConnection must be specified. -> [Help 1]
We want to avoid setting the scm.connection manually.
How to set scm.connection automatically to the current URL? - For SVN and git.
The information must be somewhere within the (metadata of the) module, since svn info displays the value under URL.
In principle, you should be able to set the developerConnection by using a parameter, but (thanks to khmarbaise for telling me) there is a bug (https://issues.apache.org/jira/browse/MRELEASE-1017) so that this does not work at the moment.
I currently work around this with my own Maven plugin. It compares the connection and developerConnection entries of the pom with the url provided by the build server (the build server knows the url because it checked out the code) and adjusts the urls if necessary (followed by scm:checkin).

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy - Cannot deploy artifacts when Maven is in offline mode

I run project deploy in Maven project and get the problem as below:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project iris: Cannot deploy artifacts when Maven is in offline mode -> [Help 1]
Could you help me figure out this problem?
Maven is configured in offline mode, that means Maven will not try to connect to any remote repository. Therefore, the maven-deploy-plugin cannot upload your jar.
Offline mode can be configured in two different ways :
launching Maven with the -o flag. Maven is offline only for this execution.
setting the offline attribute to true in the settings.xml file. Maven is offline for all executions.
One of those two options must be enabled in your configuration and you must remove it for maven-deploy-plugin to work.

Maven release without tagging

The main idea of the question is: is that a way to specify that maven release should skip tagging when performing a release?
I have the following context: we have a TFS (Team Fundation Server) as a system that version our software. We also use a svn bridge that "talks" with the TFS and developers and CI tools use it. When performing a mvn release:clean release:prepare release:perform maven complains that it cannot find or create a tag (somehow translating the tag command of the svn into a similiar command in tfs crashes). Any suggestions are appreciated.
The error looks like this:
28-May-2013 15:51:04 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:branch (default-cli) on project spring-hibernate-mysql: The scm url is invalid.
28-May-2013 15:51:04 [ERROR] - scm:svn:https://${TFS_SERVER}:${PORT}/${PATH_TO_APP}/tags/dbDiagnostic-1.0.0-RELEASE url isn't a valid svn URL.
28-May-2013 15:51:04 [ERROR] -> [Help 1]
I mention that the url is ok, because the step before this, in a CI plan is a "checkout sources" step with the same url.
The maven release plugin depends on the svn tag as it checks out the tagged version during the release process. So the answer is: No, there is no way to release without a tag.
The svn URL above is not valid, you should consider fixing it by resolving the variable substitutions.
To your question:
You can disable remote tagging by setting the remoteTagging property to false as described in: http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#remoteTagging
Note that in only works with SVN.
However, the reason for this error is most likely because maven failed to create the tag in the previous step, due to e.g. authentication failure or incorrect URL configuration ( see "tag base" attribute & etc ).

Resources