Disable Maven SCM - maven-2

Could I disable SCM integration option in Maven? I want it to build a local checked-out project without SCM integration ?
is there some settings or some how??
thanx in advance

You should check if you're using Buildnumber Maven plugin.
By default and recommended configuration it is set to be invoked on "validate" phase of every build and will fail the build with this message.
If it is the case you have two options:
Disable the use of this plugin (by removing it from POM or moving it into special profile)
Add scm section as described above.
Hope this helps!

SCM integration is only used when you want to release a new version of software or generate changelog. When build a local checked-out project SCM integration is "ignored".
There is also scm-plugin but it isn't binded to none of the default lifecycles.
EDIT
According pom reference if you declare scm section it must be valid otherwise remove scm section.
Please paste your scm section or maybe scm plugin is used in pom.

Related

Jenkinsfile DSL sourcecode

I am developing new pipeline within Jenkinsfile using intelliJ.
When I was using jenkins 1 with pipeline-dsl plugin I could go into the source code and see how DSL was actually implemented in org.jenkins-ci.plugins:job-dsl-core. I would like to have the same ability with Jenkinsfile.
Can I somehow connect Jenkinsfile DSL and intellij to have there proper code completion and sourcecode insight?
In order to have access to the sourcecode for the Pipeline Plugin suite of plugins when working on ANY Jenkins pipeline script, whether global or otherwise, you will have to include the necessary libraries as dependencies.
I'm working on my current global pipeline library.
Here adding the CPS library via "Project Structure" menu item:
Go to Libraries
Click the add button and select "From Maven..."
Type in the correct GAV (in this case com.cloudbees:groovy-cps:1.9)
Click the magnifying glass button - IntelliJ will search Maven Central (and whatever other repos you've configured in the Maven IntelliJ configuration or via your settings.xml) and download them to an your local cache.
Rinse and repeat until you've got all the dependencies you need.
When you're done, it should look something like this:
I found that the minimum useful were:
com.cloudbees:groovy-cps:1.9
org.jenkins-ci.plugins.workflow:workflow-api:2.+
Have you tried this approach yet?

Is it mandatory to provide SCM Url for getting project ID in maven central

When Registering for Maven Central/central.sonatype.org is it mandatory to specify the Project URL/SCM URL.
I have a private github repo, but I want to publish my library on maven central. How can I do that ?
Yes it's required according to the requirements.
The connection to your source control system is another required element.
In the Maven guide it says
What about artifacts that can't be distributed because of their license?
In that case only the POM for that dependency is required, listing where the dependency can be downloaded from. See an example.

How to convert Ant project to Maven project

How to convert a Ant project to Maven project? A sample project that would link (a Wicket project)
Thanks
The nice part of using maven is that most standard stuff works automatically once you do things the maven way. For a simple webapp:
Create a pom with groupId, artifactId and version (packaging: war)
Add the required dependencies to the pom
move the
java sources to src/main/java,
resources to src/main/resources,
webapp content to src/main/webapp,
test content to src/test/java and src/test/resources
set the compiler compliance version using the maven compiler plugin
That should get you up 'n' running.
http://www.sonatype.com/people/2009/04/how-to-convert-from-ant-to-maven-in-5-minutes/
I don't know what your ant script looks like, but assuming its a basic script for building, you will need to create a pom.xml file for your project, add your dependencies, and then build it via maven.
For anyone who lands here in future, there is an easier way to find dependencies for maven using the file hashes. So, you won't have to guess artifact versions.
As per the below article, the idea is to generate a SHA1 checksum of the dependency that you want to find the information, then do a reverse search in Nexus repository manager using that hash. For the checksum generation, you can use Microsoft's FCIV (free) utility.
https://devreads.xyz/ant-to-maven-conversion-the-painless-method/

Maven 2, Liquibase and dbDoc

I'd like to generate liquibase's dbdoc as part of my maven site build, but I cannot figure out how to do this. My thoughts were to add maven-antrun-plugin to the reporting section of the pom, but I cannot have an node under plugin in the reporting section. Any ideas?
This is not supported by the Maven LiquiBase Plugin so either create your own report plugin or use the dbDoc Ant Task and the Maven AntRun Plugin to generate the documentation under target/site/.
In the later case, bind the plugin on one of the phases of the Site Lifecycle (this will require some testing but I think that pre-site, site or post-site would be ok) and add an entry in the left menu in the site descriptor.
You can create your own reports plugin, more information here:
http://docs.codehaus.org/display/MAVENUSER/Write+your+own+report+plugin

Publishing POMs via Maven and inserting build version info

I'm building Maven projects via TeamCity/Git and trying to insert the TeamCity build numbers in the pom.xml that gets published to my repository upon a successful build. Unfortunately I can't determine how to publish a pom.xml with the substitutions inserted.
My pom.xml contains info like:
<version>${build.number}</version>
where build.number is provided by TeamCity. That all builds ok, and if (say) build.number = 0.1, then the deployment is a pom.xml to a directory with 0.1. All well and good.
However, the pom.xml that is deployed is the pom.xml without the substitutions made. i.e. Maven is running with a pom.xml with appropriate substitutions, but deploys the initial version and so I get
<version>${build.number}</version>
in the final pom.xml. How can I get the build version number in the pom.xml ?
I wouldn't use this approach because it makes building a project checked out from the SCM not possible without providing the build.number property. I don't think that this is a good thing. Maybe I'm missing something though.
Actually, I don't get what you are trying to achieve exactly (why don't you write the build number in the manifest for example). But, according to the Maven Features on the Teamcity website:
By default, it also keeps TeamCity build number in sync with the Maven version number (...).
Couldn't that be helpful? There is another thread about this here.
Try to use generateReleasePoms property of maven-realease-plugin, maybe that helps a little.