Generating Static Documentation for Hybris Custom REST API - swagger

As given # https://help.hybris.com/1808/hcd/99783546e09949e2b4bf27795b889464.html
section for Generating Static Documentation, I tried to use the ant wsStaticDoc command to generate the static documnetation of the custom apis that have been created, it keeps failing with the below error. Can any one help me figure out how can I resolve this error:
[artifact:mvn] [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal io.github.swagger2markup:swagger2markup-maven-plugin:1.2.0:convertSwagger2markup (default-cli) on project swagger-documentation: Execution default-cli of goal io.github.swagger2markup:swagger2markup-maven-plugin:1.2.0:convertSwagger2markup failed: Plugin io.github.swagger2markup:swagger2markup-maven-plugin:1.2.0 or one of its dependencies could not be resolved: The following artifacts could not be resolved: nl.jworks.markdown_to_asciidoc:markdown_to_asciidoc:jar:1.0, ch.netzwerg:paleo-core:jar:0.10.1: Failure to find nl.jworks.markdown_to_asciidoc:markdown_to_asciidoc:jar:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

UPDATE:
markdown-to-asciidoc lib is not synced to Maven Central
Issue - https://github.com/bodiam/markdown-to-asciidoc/issues/26
Possible solution - https://github.com/bodiam/markdown-to-asciidoc/issues/26#issuecomment-371997400
wsStaticDoc task uses maven plugins under the hood to generate documentation.
<artifact:mvn pom="#{templateDir}/pom.xml" fork="true" failonerror="true" mavenVersion="3.2.5">
<arg value="io.github.swagger2markup:swagger2markup-maven-plugin:convertSwagger2markup" />
<arg value="org.asciidoctor:asciidoctor-maven-plugin:process-asciidoc" />
<arg value="-Dswagger.input=#{swaggerInput}" />
<arg value="-Ddoc.generated=#{tempDir}" />
<arg value="-Dasciidoctor.input.directory=#{templateDir}/asciidoc" />
<arg value="-Ddoc.output=#{outputDir}" />
<jvmarg line="${env.MAVEN_OPTS} ${env.JAVA_OPTS}" />
</artifact:mvn>
Unresolved artifact actually is available (https://repo.maven.apache.org/maven2/ca/szc/thirdparty/nl/jworks/markdown_to_asciidoc/markdown_to_asciidoc/1.0/)
Most probably, you are having some network issues with maven central.
Do you have specific settings at ~/.m2/settings.xml?

Related

RTC checkout using Ant

Is there a way to checkout files from RTC using Ant scripts?. I have a scenario where i need to checkout the files from RTC and build an app using Ant.
It should be possible to invoke scm command through <exec> ant task.
You can see some examples in "Using the SCM Command Line Interface in builds"
<property name="run" value="/path/to/run_and_filter.pl"/>
<property name="scm" value="/path/to/scm"/>
<target name="__scm-checkin">
<!-- Do the initial commit -->
<exec executable="${run}" failonerror="true" outputproperty="cs">
<arg value="${scm} --non-interactive -a n -u y checkin ${roots}"/>
<arg value=" \(([^)]+)\)"/>
</exec>
<!-- Deliver -->
<exec executable="${scm}" failonerror="true">
<arg value="--non-interactive"/>
<arg value="deliver"/>
<arg value="${cs}"/>
</exec>
</target>
Make sure to use scm though, not lscm which starts a damon and can cause the ant task to hang: see "Calling lscm.bat from a build script causes a hang".
RTC does not have a "check-out" operation, which is implicit. It only has a check-in operation. If you want to get code from a repository workspace you can load it using scm command, as described before, or creating a java standalone using Plain API.

blackberry build using hudson signing automation not at configure page but inside the build

I know the automation of signature for blackberry app, as "java -jar ..signaturetool.jar....",
when I am building using hudson, i have to give at project config page by calling execute windows batch command ant task.
But am writing a build which is common for different clients, that time i want to include
this automation of signing within the build,as my app name will be changed according to the client's name and the path will be changed, so i want to execute this command line within the build, i tried this, but not working, its not executing the exec ant task.
Can anyone help me where am missing, this is the code:
<property name="signpath" location="C:/Program Files/Research In Motion/BlackBerry JDE 5.0.0/bin/SignatureTool.jar"/>
<exec executable ="cmd" os="Windows XP" >
<arg line="java -jar ${signpath} -a -c -p pswd ${codfilepath}/${uid}/${uName}_${version}_${server}.cod"/>
</exec>
I use the following ANT target for signing. It requires the use of bb_ant_tools (which seems to be an industry standard, at least among stackoverflow users).
<target name="sign" depends=""
description="Signs the final COD file by calling the BlackBerry signing server. The password is stored in the common.properties file." >
<sigtool
codfile="${cod.output.dir}/${project.output}.cod"
jdehome="${sigtool.jde}"
password="${sigtool.password}"
/>
</target>
All the parameters are stored in various properties files (I recommend keeping your signature password in a separate properties file to the rest of your project settings).
I would recommend this approach, since bb_ant_tools offers many useful features.
As to why the exec isn't working, I have had problems with exec when putting all parameters in one tag.
Try something like:
<exec executable="java" >
<arg value="-jar" />
<arg value="${signpath}" />
<arg value="-a" />
<arg value="-c" />
<arg value="-p" />
<arg value="pswd " />
<arg value="${codfilepath}/${uid}/${uName}_${version}_${server}.cod" />
</exec>
In my experience, each "space" character in the command line means you need to add a new <arg value="...." /> line to the script. ymmv.

How to correctly setup a conditional task with Maven-Ant?

New Ant user here. I've created a conditional task, which is run inside as a Maven Ant plugin. The issue I'm facing is the condition target: "ui-test-condition" is not being found during a build.
The error returned is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (uitests) on project myProject: An Ant BuildException has occured: Target "ui-test-condition" does not exist in the project "maven-antrun-". It is used from target "ui-test-run". -> [Help 1]
This would suggest a syntax error in the code below, however I'm unable to identify the issue. Any assistance is greatly appreciated.
<target name="ui-test" depends="ui-test-run,ui-test-skip"/>
<target name="ui-test-condition">
<condition property="ui-test-condition-run">
<and>
<istrue value="${ui.test}"/>
</and>
</condition>
</target>
<target name="ui-test-run" depends="ui-test-condition" if="ui-test-condition-run">
<echo>Running tests</echo>
<exec dir="src/main/webapp/ui" executable="src/main/webapp/ui/${some.executable}"
resolveexecutable="true" failonerror="true">
<arg value="-e" />
<arg value="foo/run" />
</exec>
</target>
<target name="ui-test-skip" depends="ui-test-condition" unless="ui-test-condition-run">
<echo>Tests are skipped</echo>
</target>
I had the exact same problem and I found the answer is that the depends property of a target is not supported by maven-antrun-plugin.
Excerpt of http://maven.apache.org/plugins/maven-antrun-plugin/usage.html
Ultimately, you could specify some Ant <target/> attributes in the <target/> tag. Only depends attribute in Ant <target/> is not wrapped.
That does not prevent the feature from working, at least not from experience; by just removing the depends property and ordering the targets properly, it works.
Moreover, only the last target is considered by maven-antrun-plugin. You therefore need to find a way to evaluate your condition directly in that target.

ant builds running through maven issue

So I'm building a project with maven, and in this maven pom we have a reference to an ant build script. The maven pom triggers this ant build to build a project (an install of alfresco with mysql database and tomcat server packed up with it).
The issue seems to be when you try to set up a database for alfresco to use through the ant build. This is the part of the ant build.
<target name="createDatabase">
<exec spawn="false" executable="${mysql.home}/bin/mysql" failonerror="true">
<arg value="-u" />
<arg value="root" />
<arg value="-e" />
<arg value="source ${alfresco.home}\mysql\db_setup.sql" />
</exec>
</target>
I'm getting 'unknown command '\U' sent back to me as an error on this. Of course you can install the DB manually but I want it as part of this ant script. SOmeone I work with runs this successfully on XP, but I'm getting that error on win7. Any ideas?

Maven deploy:deploy-file not found due to version/timestamp appended to jar

I'm having a problem using deploy:deploy-file with snapshots I'd like some advice on please.
I have 2 projects; 1) Ant based and 2) the other Maven based that consumes the jars of the other project via Archiva.
I've added a target to the Ant project to deploy snapshots on every successful build during our iteration.
The problem is the Maven project cannot find them because the name of the dependency has a timestamp appended like so:
someJar-1.0-20100407.171211-1.jar
Here is the Ant target:
<exec executable="${maven.bin}" dir="../lib">
<arg value="deploy:deploy-file" />
<arg value="-DgroupId=com.my.package" /><arg value="-DartifactId=${ant.project.name}" />
<arg value="-Dversion=${manifest.implementation.version}-SNAPSHOT" />
<arg value="-Dpackaging=jar" />
<arg value="-Dfile=../lib/${ant.project.name}-${manifest.implementation.version}-SNAPSHOT.jar" />
<arg value="-Durl=http://archiva.xxx.com/archiva/repository/snapshots" />
<arg value="-DrepositoryId=snapshots" />
</exec>
I have a similar Ant target for releases and this works fine.
Other pure Maven projects which deploy snapshosts via mvn deploy work fine.
Does anyone know where I am going wrong?
Thank You
Update
Figured out the answer, see below.
Figured out the answer.
In my Ant target I was deploying the file as you can see. I also then did the same thing but with the -tests jar.
This resulted in 2 snapshots in Archiva, not the usual 1 has you'd expect if you did mvn deploy.
Therefore the non test dependency could not be found because the latest snapshot was the -test jar.
Would be great to know how to solve this problem.
see Deploying non Maven based module src and tests jar to Archiva in a single transaction

Resources