Using maven-release-plugin with GitHub "You can't push to git://github.com/..." - maven

Recently having switched source code repository for a project to GitHub from SourceForge I need to update the maven release process to match. I followed this link for configuring the "scm" section of the pom. The GitHub repository is shown here. Everything else is as it was when using SVN (for publishing to https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-4.MavenRepositories). So then I invoke
mvn clean release:clean release:prepare release:perform
and the output is as follows
[INFO] --- maven-release-plugin:2.1:prepare (default-cli) # datanucleus-maven-parent ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: pom.xml.next, release.properties, pom.xml.releaseBackup, pom.xml.backup, pom.xml.branch, pom.xml.tag
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git status
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) 3.3: :
What is SCM release tag or label for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) datanucleus-maven-parent-3.3: :
What is the new development version for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) 3.4-SNAPSHOT: :
[INFO] Transforming 'DataNucleus Maven parent project'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && /usr/local/maven3/bin/mvn clean verify --no-plugin-updates -Psonatype-oss-release -P development
[WARNING] Command line option -npu is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataNucleus Maven parent project 3.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # datanucleus-maven-parent ---
[INFO] Deleting /home/andy/work/datanucleus/datanucleus-maven-parent (includes = [*.log], excludes = [])
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # datanucleus-maven-parent ---
[INFO]
[INFO] --- maven-bundle-plugin:2.4.0:manifest (default) # datanucleus-maven-parent ---
[WARNING] Ignoring project type pom - supportedProjectTypes = [jar, bundle]
[INFO]
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) # datanucleus-maven-parent ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) # datanucleus-maven-parent ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) # datanucleus-maven-parent ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.535s
[INFO] Finished at: Sat Dec 14 08:51:07 GMT 2013
[INFO] Final Memory: 14M/491M
[INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git add -- pom.xml
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git status
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git commit --verbose -F /tmp/maven-scm-1907822841.commit pom.xml
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git symbolic-ref HEAD
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git push git://github.com/datanucleus/datanucleus-maven-parent.git master:master
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.885s
[INFO] Finished at: Sat Dec 14 08:51:07 GMT 2013
[INFO] Final Memory: 15M/491M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project datanucleus-maven-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] fatal: remote error:
[ERROR] You can't push to git://github.com/datanucleus/datanucleus-maven-parent.git
[ERROR] Use https://github.com/datanucleus/datanucleus-maven-parent.git
Now a connection of "scm:git:git://github.com/{organization}/{project}.git" is what all examples I've seen for maven-release-plugin so would appreciate any insight in why it doesn't work here, or what I could look at to find out why. I can do a git push to the same URL using the user I'm logged on here as (GitHub has the SSH key).
I tried swapping the scm connection/developerConnection over to https and then get username/password prompted and it then hangs (it updates the GitHub repo with the version without SNAPSHOT) but that's all.

Actually the problem was more of believing web links of how you should configure your SCM section, so I post the answer here in case anyone else hits this message. The connection/developerConnection should be of the form
scm:git:git#github.com:{organization}/{project}.git

Related

Problem getting maven plugin from jfrog artifactory

I'm trying to get an old maven project connected to private artifactory to download plugins when building. I'm sitting in a coporate network (using vpn), using a jfrog artifactory.
"mvn clean install -U" returns:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProjektYXZ - parent POM [pom]
[INFO] ProjektYXZ - main POM [pom]
[INFO]
[INFO] ---------------------< com.*:mvn-project >----------------------
[INFO] Building ProjektYXZ - parent POM 1.14.0-SNAPSHOT [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mvn-project ---
[INFO] Deleting **mvn-project\target
[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources # mvn-project >>>
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources # mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) # mvn-project ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) # mvn-project ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-checkstyle-plugin:3.0.0:check (default) # mvn-project ---
[INFO]
[INFO] >>> spotbugs-maven-plugin:3.1.11:check (default) > :spotbugs # mvn-project >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) # mvn-project ---
[INFO]
[INFO] <<< spotbugs-maven-plugin:3.1.11:check (default) < :spotbugs # mvn-project <<<
[INFO]
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:check (default) # mvn-project ---
[INFO]
[INFO] >>> maven-pmd-plugin:3.11.0:check (default) > :pmd # mvn-project >>>
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:pmd (pmd) # mvn-project ---
[INFO]
[INFO] <<< maven-pmd-plugin:3.11.0:check (default) < :pmd # mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:check (default) # mvn-project ---
[INFO]
[INFO] --- plugin:1.4.1:enforce (default) # mvn-project ---
Downloading from central-mirror: https://artifactory.*.de/artifactory/maven/**/*-1.0.2.pom
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
[WARNING] The POM for com.**:jar:1.0.2 is missing, no dependency information available
Downloading from central-mirror: https://artifactory.**.de/artifactory/maven/**/*-1.0.2.jar
Downloading from company-releases: https://artifactory.**.de/artifactory/**/*-1.0.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ProjektYXZ - main POM 1.14.0-SNAPSHOT:
[INFO]
[INFO] ProjektYXZ - parent POM .................................. FAILURE [ 7.645 s]
[INFO] ProjektYXZ - main POM .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.826 s
[INFO] Finished at: 2022-04-12T10:18:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:plugin:1.4.1:enforce (default) on project mvn-project: Execution default of goal org.apache.maven.plugins:plugin:1.4.1:enforce failed: Plugin org.apache.maven.plugins:plugin:1.4.1 or one of its dependencies could not be resolved: Could not find artifact com.**:jar:1.0.2 in central-mirror (https://artifactory.**.de/artifactory/maven) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
in the line:
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
maven looks at the correct place. I'm able to download it with curl:
curl -u username:password -X GET "https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom"
but if I paste that path into Chrome, I get an 404 Error.
I also configured the settings.xml in my C:/Users/Username/.m2/ folder:
<server>
<id>company-releases</id>
<username>my_username</username>
<password>my_password</password>
</server>
I also checked the possible errors of the Link shown at the bottom of the log, but as I'm able to "curl" it these don't seem to be the reasons. Currently I'm out of ideas. I hope you can help me :) Please tell me if you need to see additional sources.
okay, the solution was to set preemptive authentification in settings.xml:
for example:
<server>
<username>*****</username>
<password>*****</password>
<id>central</id>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
Explanation: maven first tries to request without authentification. If the Repo is private (this means that without authentification, artifacts are hidden), jfrog artifactory responses with 404 instead of unauthenticated. After 404 maven doesn't try again, but sees it as failed.
For more details see: https://jfrog.com/knowledge-base/why-does-my-maven-builds-are-failing-with-a-404-error-when-hide-existence-of-unauthorized-resources-is-enabled/

Maven - Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (1-pre-dist) on project

I'm using wso2 emm 2.2.0 Beta, Please refer the below error console. when I run the maven install I got maven assembly plugin issue.
So please let me know why it occurs? and give some suggestion to fix this problem.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WSO2 Mobile Device Manager (MDM) - Distribution 2.2.0-BETA2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- incremental-build-plugin:1.3:incremental-build (default) # wso2emm ---
[INFO] Verifying module descriptor ...
[INFO] Verifying parent modules...
[INFO] Verifying resources...
[INFO] Resources directory does not exist : /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution/src/main/resources
[INFO] Verifying sources...
[INFO] No sources to check ...
[INFO]
[INFO] --- buildnumber-maven-plugin:1.3:create (default) # wso2emm ---
[INFO] Storing buildNumber: 27 Oct 2016 at timestamp: 1477554746130
[WARNING] Cannot get the branch information from the git repository:
Detecting the current branch failed: fatal: Not a git repository (or any of the parent directories): .git
[INFO] Executing: /bin/sh -c cd /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution && git rev-parse --verify HEAD
[INFO] Working directory: /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) # wso2emm ---
[INFO]
[INFO] --- maven-assembly-plugin:2.4:single (1-pre-dist) # wso2emm ---
[INFO] Reading assembly descriptor: /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution/src/assembly/dist.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.203s
[INFO] Finished at: Thu Oct 27 13:22:26 IST 2016
[INFO] Final Memory: 13M/188M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (1-pre-dist) on project wso2emm: Failed to create assembly: Error creating assembly archive dist: You must set at least one file.
If you want to build WSO2 EMM 2.2.0 Beta follows the below steps.
Clone the product-emm repo
git clone https://github.com/wso2/product-emm.git
Checkout the v2.2.0-BETA tag.
git checkout v2.2.0-BETA
Build from root pom. Go to project root folder and issue
mvn clean install
If you want just product zip you can build the distribution module for that go to project root -> modules ->distribution folder and issue mvn clean install from there. you can find the build zip file in distribution/target folder.
It seems like you are in master branch. The failing maven goal for you added after the emm beta tag creation. The reason for failing is, in build time it tries to connect to some resources in internet and your computer failed to connect to that resources on internet. If you really want to build the master branch (2.2.0-SNAPSHOT), just check your internet connection or firewall blockings.

How to debug "The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found"?

This is what I am trying to do. I have installed Maven. Set the path till bin folder of Maven.
C:\Workspace\Eaxample>mvn archetype:generate -DgroupId=com.mkyong -DartifactId=N
umberGenerator
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: Connecti
on timed out: connect
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Tue Nov 24 14:04:15 IST 2015
[INFO] Final Memory: 5M/122M
You forget archetypeArtifactId :
Do this :
mvn archetype:generate -DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/

"Auth fail" error with maven-scm-provider-jgit during release:prepare

I am on a windows machine where git command line is not installed. I have installed GitExtensions and an EGit and this is sufficient for me (until now).
Now I wanted to perform a maven release to BinTray, following this guide:
Publishing releases using Github, Bintray and maven-release-plugin
Running:
mvn -Prelease release:prepare
Produces this output:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\jbr\git\yyyyyyyyyyyyyyy
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.770 s
[INFO] Finished at: 2015-09-12T20:17:24+02:00
[INFO] Final Memory: 20M/989M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] 'git' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
Absolutely fair, I never use the git command from the windows shell and I never set up the pageant.exe stuff. (for details see this answer to the question “Why git can't remember my passphrase under Windows”).
My second idea was to use the maven-scm-provider-jgit to not depend on the git command line.
The output is now:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Change the default 'git' provider implementation to 'jgit'.
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] push changes to remote... refs/heads/master:refs/heads/master
[INFO] fetch url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] push url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: An error is occurred in the checkin process: Exception while executing SCM command. JGit checkin failure! git#github.com:jmini/yyyyyyyyyyyyyyy.git: Auth fail -> [Help 1]
Much better, but still no luck.
My guess is that the private key and the passphrase are not loaded. How should I configure them?
This answer suggests that for some SCM providers, it is possible to specify the credentials in the <servers> section of settings.xml. The domain name of the repository should be used as <id>.
According to the last comment with scm:git:ssh://git#bitbucket.org/{account}/{project} used in the <developerConnection>, this entry is working in the settings.xml:
<server>
<id>bitbucket.org</id>
<privateKey>/c/Users/neil.hunt/.ssh/id_rsa</privateKey>
</server>
Is this construct supported by the JGit SCM provider?
When searching for “Auth failed” error, I found this related question (plain JGit, no maven plugin):
How do you set the configuration for jschconfigsessionfactory for jgit so that pull and push work?

Maven Dependency Plugin appendOutput Parameter is Failing?

UPDATE: This issue seems to have resolved itself. I could still produce it on a copy of the source code, but it was a temporary copy that I deleted before realizing I would need it to pin this issue down. I'm continuing to track this and see if I can identify a root cause. If not, I will close the issue.
When I run mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true from the root directory of a multi-module Maven project, the resultant output file only contains the dependencies of the last module declared in the modules section of the root pom.xml file. Is there something different I need to do to get the output of each submodule to append to the output file?
Configuration:
Maven 3.0.3
maven-dependency-plugin 2.6
When I'm using the following command: -
mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true
The result is invalid and the Maven told me that
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) # ...
Then I change to specify the version
mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:list -DoutputFile=/path/to/file.txt -DappendOutput=true
The result is valid and the Maven told me that
[INFO] --- maven-dependency-plugin:2.6:list (default-cli) # ...
I would suggest you to ensure that the executing is the version 2.6. Anyhow I always use the following command as
mvn dependency:list > /path/to/file.txt
IMHO the result is better and more clear for each module as the following example: -
[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] my-parent
[INFO] my-sub1
[INFO] my-sub2
[INFO]
[INFO] -------------------------------------------------------------------
[INFO] Building my-parent
[INFO] -------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) # my-parent ---
[INFO]
[INFO] The following files have been resolved:
...
[INFO] -------------------------------------------------------------------
[INFO] Building my-sub1
[INFO] -------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) # my-sub1 ---
[INFO]
[INFO] The following files have been resolved:
...
[INFO] -------------------------------------------------------------------
[INFO] Building my-sub2
[INFO] -------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:list (default-cli) # my-sub2 ---
[INFO]
[INFO] The following files have been resolved:
...
[INFO]
[INFO] -------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] my-parent ........................................ SUCCESS [0.745s]
[INFO] my-sub1 .......................................... SUCCESS [0.675s]
[INFO] my-sub2 .......................................... SUCCESS [0.671s]
[INFO] -------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -------------------------------------------------------------------
[INFO] Total time: 2.938s
[INFO] Finished at: Fri Mar 01 17:01:39 ICT 2013
[INFO] Final Memory: 17M/218M
[INFO] -------------------------------------------------------------------
I hope this may help.
Regards,
Charlee Ch.

Resources