Installing a wsdl file into a Maven repository - wsdl

I'm trying to install a wsdl file into a remote Maven repository so I can reference it in a CXF project as per this blog post.
I'm sure it could be done manually, but I want an actual maven project so I can make use of the release plugin for tagging etc.
Has anybody got experience with this?

You can use the build helper maven plugin to do this. Here is an indicative code snippet
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${wsdlLocation}/project.wsdl</file>
<type>wsdl</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build.

Related

Maven - Shade Plugin doesn't work when creating Manifests

I have tried shading my jar using a custom manifest file and also manifest entries. In both cases, it's not even accepting any manifest file.
I have looked into Apache Maven docs for Shade plugin and it's not working as per the docs.
Here is my Shade Config:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>kafkapub.main.app.MainApp</mainClass>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>launcher</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Has anyone seen similar issues ?
I think I sorted the issue.
Basically it created the -shaded artifacts. And since there were three jars:
original-*.jar
*.jar
*-shaded.jar
It was quite confusing. But I can see everything in the Shaded jar now thanks.

How to download multi files from swagger

I've an issue when try to download file from swagger.
When I compiled a code with config below, I got an error:
Could not find goal 'download' in plugin io.swagger:swagger-codegen-maven-plugin:2.3.1 among available goals generate
I've tried to break to 2 plugins and it compiles successfully, but just one file is downloaded.
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>download</goal>
</goals>
<configuration>
<api>Addresses</api>
<owner>test</owner>
<version>2.13.0</version>
<format>yaml</format>
<token>test</token>
<outputFile>${address-service-swagger.file}</outputFile>
</configuration>
</execution>
<execution>
<id>aec</id>
<phase>generate-sources</phase>
<goals>
<goal>download</goal>
</goals>
<configuration>
<api>Shipper</api>
<owner>test</owner>
<version>2.13.0</version>
<format>yaml</format>
<token>test</token>
<outputFile>${shipper-service-swagger.file}</outputFile>
</configuration>
</execution>
</executions>
</plugin>
By the way, I want to define outputFile is a file in the folder target, and I've tried to change outputFile by the target path, but It compiles fail. Do you have any idea for this case?
Thank you for your helps
As mentioned in the comments, to download API definitions from SwaggerHub you need to use the swaggerhub-maven-plugin, not swagger-codegen-maven-plugin.
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swaggerhub-maven-plugin</artifactId>
...
</plugin>
You are using the wrong plugins and you can do like this
If your swaggerhub api link is like this https://app.swaggerhub.com/apis/massivebet/betting/0.9.0 then you config this and run
mvn clean generate-resources to download as yaml file
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swaggerhub-maven-plugin</artifactId>
<version>1.0.8</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>download</goal>
</goals>
<configuration>
<api>betting</api>
<owner>massivebet</owner>
<version>0.9.0</version>
<host>api.swaggerhub.com</host>
<format>yaml</format>
<token>your token if private apis</token>-->
<outputFile>target/test.yaml</outputFile>
</configuration>
</execution>
</executions>
</plugin>

Analyzed bundle 'dump' with 0 classes

In the current configuration, I am using a jacoco-agent in the tcpserver mode for web application deployed on the serve node. Also, using jacoco-maven plugin to generate dump and report from my local node. I am able to get the dump in my local node by task mvn jacoco:dump. But when trying to generate the report against dump file by task mvn jacoco:report, getting "Analyzed bundle 'dump' with 0 classes".
Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<address>*.*.*.*</address>
<destFile>/app/jacoco_agent/new.exec</destFile>
<port>7906</port>
<reset>true</reset>
<append>false</append>
</configuration>
<executions>
<execution>
<phase>post-integration-test</phase>
<goals>
<goal>dump</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>/app/jacoco_agent/new.exec</dataFile>
<outputDirectory>/app/jacoco_agent/jacoco-ut</outputDirectory>
<includes>/target/classes</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
How can I generate a report by using jacoco-maven plugin?
Successfully able to generate a report by jacococli.jar.
java -jar ~/Downloads/jacoco-0.7.10-20171007.201717-57/lib/jacococli.jar report /app/jacoco_agent/new.exec --classfiles /target/classes --html report
Please help me to understand what's wrong, I am doing here with jacoco-maven plugin configuration?
Thanks

Issues during Soapui and Jenkins integration

I am trying to integrate Soapui open source version 4.5.1 with Maven & then finally trying to make it run from CI.
But unfortunately the test classes are executing fine both from eclipse and command line in local system but fails in CI with this message:
16:58:34 16:58:34,323 INFO [WsdlProject] Loaded project from [file:/var/lib/jenkins/jobs/rps_deals30_unittests_automation_priya/workspace/RPService/src/test/resources/serviceautomation/GService-Deals-Test-soapui-project.xml]
16:58:36 java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
16:58:36 at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:240)
16:58:36 at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193)
16:58:36 at java.util.jar.JarVerifier.processEntry(JarVerifier.java:262)
16:58:36 at java.util.jar.JarVerifier.update(JarVerifier.java:216)
16:58:36 at java.util.jar.JarFile.initializeVerifier(JarFile.java:411)
16:58:36 at java.util.jar.JarFile.getInputStream(JarFile.java:478)
16:58:36 at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:1003)
...
...
This is the relevant snippet from my pom.xml file:
<plugins>
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>
<executions>
<execution>
<phase>verify</phase>
<id>soapui-tests</id>
<configuration>
<projectFile>${project.basedir}/src/test/resources/serviceautomation/GService-Deals-Test-soapui-project.xml</projectFile>
<outputFolder>${basedir}/target/soapui</outputFolder>
<junitReport>true</junitReport>
<exportwAll>true</exportwAll>
<printReport>true</printReport>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration></configuration>
</plugin>
</plugins>
</build>
Not sure where you got that pom configuration from, or what you are trying to do. Using the recommended pom from the the official documentation, you should just have:
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>
<configuration>
<projectFile>src/test/resources/serviceautomation/GService-Deals-Test-soapui-project.xml</projectFile>
<outputFolder>target/soapui</outputFolder>
<junitReport>true</junitReport>
<exportwAll>true</exportwAll>
<printReport>true</printReport>
</configuration>
</plugin>
Skip all the executions specific things, that is what causing your problems.

Maven generate javadoc for one submodule

I have a maven project with submodules.
Is is it possible to run on the root pom:
mvn clean install javadoc:javadoc
And building all the project (submodules) but generating the javadoc only for one of the submodule ? Cause I'm only interesseted to publish the javadoc of one.
My pom.xml contains the maven-javadoc-plugin.
Thanks.
Configure the Javadoc plugin within the module you want to have the javadoc generated:
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
[...]
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
This config will create the Javadoc each tome you call mvn package or mvn install

Resources