How to add a directory to the bitbucket pipline environment? - spring

I have a spring boot project that uses bitbucket pipelines for its CI/CD deployment.
It was working fine until I added a react front end to bundle with the project.
I added this to my pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/classes/public">
<fileset dir="${project.basedir}/ob-frontend/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
and now the pipeline fails with
[INFO] --- frontend-maven-plugin:1.12.1:npm (npm install) # scienta ---
[INFO] Running 'npm install' in /opt/atlassian/pipelines/agent/build/ob-frontend
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.360 s
[INFO] Finished at: 2022-05-29T11:06:17Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:npm (npm install) on project scienta: Failed to run task: 'npm install' failed. java.io.IOException: /opt/atlassian/pipelines/agent/build/ob-frontend doesn't exist. -> [Help 1]
I understand that the new plugin creates a new directory, and the bitbucket pipeline env isn't doing that, I'm unsure how to tell the pipeline to do that.

This answer helped me fix my issue:
https://stackoverflow.com/a/35498001/4831652
I wrapped the plugins in my pom.xml with
<pluginManagement>...</pluginManagement>

It looks like it didn't even get to executing your maven-antrun-plugin task because it's the frontend-maven-plugin which fails.
Running 'npm install' in /opt/atlassian/pipelines/agent/build/ob-frontend
...
/opt/atlassian/pipelines/agent/build/ob-frontend doesn't exist
Here /opt/atlassian/pipelines/agent/build must be the ${project.basedir} when it's cloned to the build agent filesystem (since you expect the results of the frontend build be available in ${project.basedir}/ob-frontend/build). So the error says the frontend source directory ${project.basedir}/ob-frontend doesn't exist for some reason.
Regarding your question on creating directories during build, there's an mkdir Ant task, which can be configured like so:
<configuration>
<target>
<mkdir dir="${basedir}/target/some-dir" />
...
</target>
</configuration>

Related

How to regenerate the source spring boot server-code from swagger-codegen-maven-plugin with modified swagger definition

My requirement is that I have to generate the springboot server code from a swagger definition. I have generated the code with the help of below-mentioned command (by using swagger-codegen-cli-2.3.1.jar).
java -jar swagger-codegen-cli-2.3.1.jar generate ^
-i nycemoves.yml ^
--api-package com.nyce.moves.api ^
--model-package com.nyce.moves.model ^
--invoker-package com.nyce.moves.invoker ^
--group-id com.nyce.moves ^
--artifact-id nyce-moves ^
--artifact-version 0.0.1-SNAPSHOT ^
-l spring ^
--library spring-boot ^
-o nyce-moves
Now, we have updated the swagger definition and want to re-generate the resulting models and api-invokers, for this we would like to use a maven plugin.
After looking through various answers on the internet, we came across the following build plugins which we have added in our pom.xml.
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/resources/nycemoves.yml</inputSpec>
<language>spring</language>
<basePackage>${default.package}</basePackage>
<modelPackage>${default.package}.model</modelPackage>
<apiPackage>${default.package}.api</apiPackage>
<invokerPackage>${default.package}.invoker</invokerPackage>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>spring-boot</library>
<serializableModel>true</serializableModel>
<sourceFolder>src/main/java</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Now, when we do mvn clean package, we want it to update / override all the models, api and invokers. But, this is not working. We are seeing the below mentioned exception.
[INFO] 16 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.516 s
[INFO] Finished at: 2019-03-06T15:05:58+05:30
[INFO] Final Memory: 34M/448M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project nyce-moves: Compilation failure: Compilation failure:
[ERROR] /nyce-moves/src/main/java/com/nyce/moves/api/CommentsApi.java:[29,8] duplicate class: com.nyce.moves.api.CommentsApi
[ERROR] /nyce-moves/target/generated-sources/swagger/src/main/java/com/nyce/moves/model/PostRequest.java:[19,8] duplicate class: com.nyce.moves.model.PostRequest
...
So, we actually need the plugin to do the following things, but we are not able to figure it out.
a) When we run mvn clean package it should regenerate all the source-code for the server stub in source folder as well as target folder.
b) In case of the class already exists, it should override them. We would like to handle the override later with the help of .swagger-codegen-ignore.
I know there are lots of discussion threads on this on stackoverflow, but I could not find any solution which can help me here. Please help me on this or direct me to the relevant thread.
I had the same problem and I needed to define also the output directory. Here is a snippet:
<configuration>
<language>spring</language>
<library>spring-cloud</library>
<configOptions>
<sourceFolder>swagger</sourceFolder>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
</configOptions>
<output>${project.build.directory}/generated-sources</output>
</configuration>

"bower-installer" in front-end-maven gives error

I am using front-end-maven plugin to run npm and bower in maven. (https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md#working-directory)
But I want to use bower-installer , which keeps only required min file instead of all the repo. (https://www.npmjs.com/package/bower-installer).
But trying to include bower-installer gives me error in maven.
<execution>
<id>bower-installer</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>-installer</arguments>
</configuration>
</execution>
This takes as bower -installer while doing maven build.
--- frontend-maven-plugin:1.3:bower (bower-installer) # tomcat7 ---
[INFO] Running 'bower -installer' in C:\Users\userName\workspace\samplePrj
[INFO]
[INFO] Usage:
[INFO]
[INFO] bower <command> [<args>] [<options>]
But corresponding folder will not be created. Please note the space between bower and -installer. The command should be bower-installer.

nexus-staging-maven-plugin refuse to upload after deferred deployment

I have a multi-module project that has nexus-staging-maven-plugin configured in parent pom.xml:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
</configuration>
</plugin>
By default it should be inherited by all submodules (except those disabled using technique in How to disable nexus-staging-maven-plugin in sub-modules)
However, when I start deployment:
mvn clean deploy -DskipTests=true -Prelease-sign-artifacts -Dgpg.passphrase=*****
I see the following message:
[INFO] Installing Nexus Staging features:
[INFO] ... total of 5 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
...
[INFO] --- nexus-staging-maven-plugin:1.6.6:deploy (injected-nexus-deploy) # spookystuff-core ---
[INFO] Performing deferred deploys (gathering into "/home/peng/git/spookystuff/target/nexus-staging/deferred")...
[INFO] Installing /home/peng/git/spookystuff/core/target/spookystuff-core-0.3.2-SNAPSHOT.jar to /home/peng/git/spookystuff/target/nexus-staging/deferred/com/tribbloids/spookystuff/spookystuff-core/0.3.2-SNAPSHOT/spookystuff-core-0.3.2-SNAPSHOT.jar
...
[INFO] Reactor Summary:
...
[INFO] BUILD SUCCESS
No upload happens whatsoever. The artifact that should be uploaded to nexus were still cached under:
/target/nexus-staging/deferred
but neither the log nor nexus server record indicates that it has been uploaded. What has been wrong here and what should I do to fix it?

How to revert Maven project.build variables after Clover plugin finishes?

I'm attempting to add integration tests to a large Maven project. Here is the desired order of events:
Clean existing artifacts.
Resolve dependencies and build project.
Run unit tests via Surefire plugin.
Fork lifecycle for Clover plugin.
--- Instrument sources using Clover plugin.
--- Modify project.build.directory and project.build.finalName for Clover.
--- Build Clover instrumented project in a new directory.
--- Run Clover instrumented unit tests via Surefire plugin.
--- Check code coverage from Clover instrumented unit tests.
--- Reset project.build.directory and project.build.finalName to original values.
--- End forked lifecycle (Clover only forks through 'test' phase).
Package project as a WAR file.
Locally host project WAR file via Tomcat7 plugin.
Run integration tests against Tomcat7 instance via Surefire plugin.
All of this works as expected except step #9 (hence the question). Instead, the build directory is still set to the Clover version, and the project name has "-clover" appended to it. I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
Even if it did work, We do not need/want Clover instrumentation in the WAR file which we're testing against because the integration tests don't touch any of the production code (it's all Selenium UI stuff under src/test/java which interacts with the locally hosted pages instead of the production code itself).
As mentioned, this is a large project containing hundreds of dependencies and dozens of plugins. I believe the following are relevant to my issue, though I can dig up more if necessary (posting the entire pom file seems unreasonable).
Here's the pom configuration for the Clover plugin:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.1.11</version>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<licenseLocation>${basedir}/src/test/resources/clover.license</licenseLocation>
<targetPercentage>92%</targetPercentage>
<excludes>
<exclude>**/mock/*.java</exclude>
<exclude>**/com/mycompany/somestuff/*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>generate-clover-report</id>
<phase>test</phase>
<goals>
<goal>instrument</goal>
<goal>clover</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the pom configuration for the WAR plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<!--Implementation-Build>${buildNumber}_${timestamp}</Implementation-Build -->
<Build-Time>${timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
Here's the pom configuration for the Tomcat7 plugin:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<ajpPort>8009</ajpPort>
<backgroundProcessorDelay>2</backgroundProcessorDelay>
<configurationDir>${project.build.directory}/tomcat7_plugin</configurationDir>
<contextFile>${CATALINA_HOME}/conf/context.xml</contextFile>
<contextReloadable>false</contextReloadable>
<fork>true</fork>
<hostName>localhost</hostName>
<httpsPort>8443</httpsPort>
<ignorePackaging>false</ignorePackaging>
<jarScanAllDirectories>false</jarScanAllDirectories>
<path>/contentmain</path>
<port>8080</port>
<serverXml>${CATALINA_HOME}/conf/server.xml</serverXml>
<tomcatUsers>${CATALINA_HOME}/conf/tomcat-users.xml</tomcatUsers>
<tomcatWebXml>${CATALINA_HOME}/conf/web.xml</tomcatWebXml>
<useNaming>true</useNaming>
<useTestClasspath>true</useTestClasspath>
<update>true</update>
<warDirectory>${project.build.directory}/${project.build.finalName}</warDirectory>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run-war-only</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the current (desired) behavior when I run "mvn clean install -Dmaven.clover.skip":
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/MyProject]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [2019 msecs]
[INFO] Building war: /mydir/MyProject/target/MyProject.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[INFO] Building jar: /mydir/MyProject/target/MyProject-sources.jar
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
Here's the current (undesired) behavior when I run "mvn clean install" (note the paths listed by maven-war-plugin and warning message from maven-source-plugin:
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/clover/MyProject-clover]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [1770 msecs]
[INFO] Building war: /mydir/MyProject/target/clover/MyProject-clover.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
What can I do to make sure that the {project.build.directory} and {project.build.finalName} values are reset to their original values after Clover has finished executing the maven-clover2-plugin:check goal during the test phase of the forked lifecycle?
I've already tried browsing the online manuals for Clover, the WAR plugin, and Tomcat7. I see no mention of any settings I can use to revert the build variables that are altered by Clover. I can always hard-code the paths in my pom file, but I'd prefer a less brittle solution.
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
This is a limitation of Maven. It does not support artifacts with multiple classifiers. As the artifact in a forked life cycle has the "clover" classifier already, it cannot have "source" classifier at the same time. That's why this warning is present. You may consider using the clover2:setup instead of the clover2:instrument if you need to call a maven-source-plugin.
4. Fork lifecycle for Clover plugin.
--- End forked lifecycle (Clover only forks through 'test' phase).
There are two Clover goals which forks a build:
clover2:instrument - forks a build till the 'install' phase
clover2:instrument-test - forks a build till the 'test' phase
You may be interested in the latter one. You may also be interested in using the useCloverClassifier=false option - this will disable usage of the "clover" classifier in a forked build.
I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
My first guess is that you have clover.jar (com.atlassian.clover:clover) missing at runtime. You have to either copy clover.jar to Tomcat's /lib directory or to bundle it in your WAR. See https://confluence.atlassian.com/display/CLOVER/Using+Clover+for+web+applications
It turns out that Clover will always alter these variables unless the clover2:setup target is used. However, if you still wish to fork the lifecycle for Clover (IE: clover2:instrument or clover2:instrument-test) then these variables will always be altered.
We wish to continue forking the lifecycle using clover:instrument-test, so I've come up with a workaround. Instead of using the project.build.finalName and project.build.directory variables, I'm using my own variables that get copied and saved on Maven execution before Clover can mess with them:
<properties>
<!-- Saving these variables now before Clover alters them -->
<original.build.finalName>${project.build.finalName}</original.build.finalName>
<original.build.directory>${project.build.directory}</original.build.directory>
</properties>
I then tell all of the subsequent plugins to use these variables instead of the project variables which Clover has altered:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<cacheFile>${original.build.directory}/war/work/webapp-cache.xml</cacheFile>
<outputDirectory>${original.build.directory}</outputDirectory>
<warName>${original.build.finalName}</warName>
<webappDirectory>${original.build.directory}/${original.build.finalName}</webappDirectory>
<workDirectory>${original.build.directory}</workDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<configurationDir>${original.build.directory}/tomcat7_plugin</configurationDir>
<warDirectory>${original.build.directory}/${original.build.finalName}</warDirectory>
</configuration>
</plugin>
</plugins>
Alternative solutions might include creating or utilizing an additional plugin in a subsequent Maven phase to revert the project.build variables after Clover has finished executing. Either of these solutions is probably better than hard-coding the paths in all of your plugins.

Maven build hanged with release and gpg plugins

I've been struggling with a Maven 3.0.5 build, trying to deploy to Sonatype repo, using maven release plugin and maven gpg plugin in a Windows XP system. My problem is exactly the same as this SO question, but none of the solutions provided there is working for me.
The relevant fragments of my pom.xml are:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
<!-- see http://jira.codehaus.org/browse/MGPG-9 -->
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<scm>
<connection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</connection>
<developerConnection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</developerConnection>
<url>https://github.com/pentasoft/s3-static-uploader</url>
<tag>s3-static-uploader-1.0</tag>
</scm>
The ouptut of my build is the following:
---
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 29.737s
[INFO] Finished at: Fri Jul 05 15:58:20 CEST 2013
[INFO] Final Memory: 16M/40M
[INFO] ---------------------------------------------------------------------
---
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml s3-static-uploader-plugin\po
m.xml s3-static-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\DOCUME~1\jgg\CONFIG~
1\Temp\maven-scm-870876840.commit pom.xml s3-static-uploader-plugin\pom.xml s3-s
tatic-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git push https://github.com/pentasoft/s3-static
-uploader.git master:master"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
The build hangs here.
I've tried all the solutions provided in the previously referenced SO question and all of them produce the same result.
After a long fight with this, there were two problems mainly. The first one was related to the urls specified in scm section of the pom.xml file. My schemas were https and github was prompting me for the user, but there were no output on the screen showing that prompt. So the first step was changing the url schemas to the following:
<scm>
<connection>scm:git:git#github.com:pentasoft/s3-static-uploader.git</connection>
<developerConnection>scm:git:git#github.com:pentasoft/s3-static-uploader.git</developerConnection>
<url>https://github.com/pentasoft/s3-static-uploader</url>
</scm>
where the https schemas have been replaced by the ssh schema.
After fixing this there was a second problem regarding to the ssh access to Github. When launching the build, Github was answering with the following:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
As in the previous problem these prompt doesn't show and the feel is that the build is hanged again. In order to fix this, I issued the command ssh -T git#github.com (see this Github guide) and I answered yes to that question in order to avoid that prompt in the future.
After all this the build is not hanged anymore (following the instructions of #AWhitford in the previously referenced SO question).
May be all this would have been easier with a non Windows box...

Resources