So I'm working with maven for the first time to learn grpc and protobuf, but after I gen the code, the generated java files do not compile. I tried generating the code in a seperate java project(and I dragged in all the jars by themselves, which were downloaded from maven repository), but that project somehow managed to compile. Does anyone know why this occurs?
Pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.14.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.14.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.14.0</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.14.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Some of the errors I get:
"the hierarchy of Feature is inconsistent"- in Feature.java
"The type com.google.protobuf.AbstractMessage$Builder cannot be resolved. It is indirectly referenced from required .class files" - in Feature.java, even though the protobuf lib is in the project
"The method bindService() of type RouteGuideGrpc.RouteGuideImplBase must override a superclass method" - in RouteGuideGrpc.java, even though it is overriding the method according to the api
Thanks!
Related
As the title says, I'm just trying to run the javafx application. However I have no idea why I'm getting this error, and I don't know why the error is referencing the sisu.inject.bean and aopalliance modules. I don't know wether the module-info.java or the pom.xml is causing the error. Thanks in advance for any anwser.
module-info.java:
module ui {
requires javafx.fxml;
requires transitive javafx.graphics;
requires javafx.controls;
requires org.testfx.junit5;
requires junit;
requires core;
exports ui.java;
exports test.ui to junit;
}
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>it1901.nachwithme</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ui</artifactId>
<dependencies>
<!-- UI imports core as a dependency -->
<dependency>
<groupId>it1901.nachwithme</groupId>
<artifactId>core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- Dependencies for javafx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
</dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-core</artifactId>
<exclusions>
<exclusion>
<!-- https://mvnrepository.com/artifact/org.sonatype.sisu/sisu-inject-bean -->
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-bean</artifactId>
</exclusion>
<exclusion>
<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Dependencies for javafx -->
<!-- Dependencies for unit-testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>16-ea+2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testfx</groupId>
<artifactId>testfx-junit5</artifactId>
<scope>compile</scope>
</dependency>
<!-- Dependencies for unit-testing -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<configuration>
<options>
<!-- <option>dash dash enable-preview</option> -->
</options>
<mainClass>ui.java.App</mainClass>
</configuration>
</plugin>
</plugins>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.png</include>
</includes>
</resource>
</resources>
<testSourceDirectory>src/test</testSourceDirectory>
<testResources>
<testResource>
<directory>test</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.png</include>
</includes>
</testResource>
</testResources>
</build>
</project>
Error:
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules sisu.inject.bean and aopalliance export package org.aopalliance.aop to module org.testfx
Process finished with exit code 1
TL;DR — The two modules have a split package in common. And JPMS forbids split packages.
The long-winded version
The first sentence of this 2010 blog gives a summary of what a split package is…1
„…A “split package” is a pretty old Java term where you have packages in different libraries with the same name providing related (or sometimes unrelated functionality)…“
Keep in mind that was written in 2010 though; before JPMS. So the blog's claim of „without any problem at both compile and runtime“ in the second sentence is out-of-date; for the modulepath in any case.
For a way more detailed, more up-to-date explanation, watch this Project Jigsaw: Under the Hood video from JavaOne 2016.2
„…why the error is referencing the sisu.inject.bean and aopalliance modules…“
Because your project has a module descriptor (module-info.java) Maven has put those dependencies — which I can see you declared in your pom — on the modulepath.
„…However I have no idea why I'm getting this error…“
Because JPMS abhors split packages…3
…
„There are two issues with split packages,
if you have the same class in each part of the package, the behavior of your
[program] depend on the order in the classpath,
i've experienced this kind of bugs with two different libraries requiring
different version of ASM, at runtime, a class of the older version was calling a
class of the newer version :(
security, if you allow split packages, you allow anybody to insert any classes in any packages.
…
The solution
…
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<options>
<option>--patch-module</option>
<option>org.sonatype.sisu=${env.M2_REPO}/aopalliance/aopalliance/1.0/aopalliance-1.0jar</option>
</options>
<mainClass>ui.java.App</mainClass>
</configuration>
</plugin>
…
1 That blog talks about OSGi. But the core split package definition applies to JPMS too.
2 Project Jigsaw: Under The Hood — accompanying slides.
3 Rémi Forax — The split package problem — Jigsaw Dev Mailing List — November 2016.
My goal is to call a third party web service. So I generated the java classes from the wsdl using axis2 wsdl2java and adb data binding.
I'm calling the web service using these generated classes which works fine.
Now I want do do this in a bundle which is deployed on the osgi container apache karaf. I am building the bundle using the maven-bundle-plugin. Here I got the problem that karaf needs all those requirements of axis2 (axiom, mime4j, commons-fileupload,etc etc).
Is there any good solution to get axis2 to work on karaf besides deploying all those dependencies as bundles on karaf (because these are quite a lot)?
This is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>AxWebServiceCall</groupId>
<artifactId>AxWebServiceCall</artifactId>
<packaging>bundle</packaging>
<version>1.0</version>
<name>Ax WebService calls</name>
<url></url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.15.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>2.15.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.15.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- to generate the MANIFEST-FILE of the bundle -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>AxWebServiceCall</Bundle-SymbolicName>
<Private-Package>AxWebServiceCall.*</Private-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.3</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<packageName>com.foo.myservice</packageName>
<wsdlFile>src/main/resources/wsdl/axservice.wsdl</wsdlFile>
<databindingName>adb</databindingName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
And how I call the WebService
RoutingServiceStub stub = new RoutingServiceStub(
"http://some.url");
PaygateServiceHBXProcessRequest paygateRequest = new PaygateServiceHBXProcessRequest();
PaygateContractHBX contract = new PaygateContractHBX();
contract.setLength(Integer.valueOf(data.get("length").toString()));
contract.setData(data.get("encrypted_data").toString());
paygateRequest.set_paygateContract(contract);
CallContextE context = new CallContextE();
CallContext paygateContext = new CallContext();
paygateContext.setCompany("HB2C");
context.setCallContext(paygateContext);
PaygateServiceHBXProcessResponse response = stub.process(
paygateRequest, context);
AusfuehrungErgebnis response2 = response.getResponse();
And the error I get in the karaf logs
[...]Unable to resolve 994.0: missing requirement [994.0] osgi.wiring.package; (osgi.wiring.package=org.apache.axiom.om)[...]
As I said I can solve this by deploying the axiom bundle but then it needs the next dependency which I could also deploy and so on...But as I said I want this to work without deploying numerous bundles manually.
I'm new into Groovy and I'm trying to write a very simple project using Groovy as language. I was able to write a hello world script, deploy an mvn artifact and execute it.
I'm going beyond that right now and I need to import some external libraries for testing matters but I don't know how to do that.
I would really appreciate if you could give me some tips about this.
Thanks!
You can specify dependencies for the project which have test scope, in which case they will not be used in compile scope, or you can specify dependencies which are only used in certain scenarios (if, for example, you want to write Groovy tests without requiring the rest of your team to do so).
This sample pom.xml has a custom profile element which describes dependencies and executions to run only if the current environment user is "andylopresto". This means that if my team doesn't want to use Groovy in their build, I could still write my test classes in Groovy and have them run as part of the standard mvn test phase on my machine only. In my team members' local machines (or a shared Jenkins instance), the Groovy test files will be ignored (not compiled or run, and the groovy-all dependency will not even be downloaded onto the machine).
Example:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.package</groupId>
<artifactId>artifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<developers>
<developer>
<id>alopresto</id>
<name>Andy LoPresto</name>
<email>alopresto#example.com</email>
<roles>
<role>developer</role>
<role>owner</role>
</roles>
</developer>
<developer>
<id>jjava</id>
<name>Johnny Java</name>
<email>ihategroovy#example.com</email>
<roles>
<role>sticking to older languages</role>
</roles>
</developer>
</developers>
<dependencyManagement>
<dependencies>
<!-- This dependency is available to all project code -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<!-- This dependency is only available during test phase -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- This dependency is expected to be provided outside of Maven -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version>8.0.8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<!-- Custom profile for Groovy tests used only on Andy's computer -->
<id>andyLocalTest</id>
<activation>
<property>
<name>env.USER</name>
<value>andylopresto</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.2.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/groovy</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>1.6</source>
<target>1.6</target>
<includes>
<include>**/*.java</include>
<include>**/*.groovy</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.5-03</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
How can I use wsimport -clientjar in my POM.xml.
I am expecting this would download java sources, create Jar out of it and deletes the source.
Can you please give me an example POM for me?
Thank you.
I know its an old question but in case someone else is looking,
I am using this pom for my tests:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xerox.3dprinterfarm</groupId>
<artifactId>3DPrinterInterfaceTests</artifactId>
<version>1.0-SNAPSHOT</version>
<name>3D Printer Interface Tests</name>
<description>3D Printer Interface Tests</description>
<build>
<plugins>
<!-- use the jax-ws maven plugin-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>wsimport-from-jdk</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- using wsdl from an url -->
<wsdlUrls>
<wsdlUrl>
https://webservices.xerox.com/3dPrints?WSDL
</wsdlUrl>
</wsdlUrls>
<!-- or using wsdls file directory -->
<!-- <wsdlDirectory>src/wsdl</wsdlDirectory> -->
<!-- which wsdl file -->
<!-- <wsdlFiles> -->
<!-- <wsdlFile>myWSDL.wsdl</wsdlFile> -->
<!--</wsdlFiles> -->
<!-- Keep generated files -->
<keep>true</keep>
<!-- Package name -->
<packageName>com.xerox.3dprinterfarm</packageName>
<!-- generated source files destination-->
<sourceDestDir>target/generatedclasses</sourceDestDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Have a look at the JAX-WS Maven Plugin.
Quick briefing on my situation - I'm working on a code base that has JAX-WS annotated interfaces/classes that we generate code-first wsdls from. We are using CXF's cxf-java2ws-plugin to generate wsdls at build time within maven for inclusion within the .jar produced for each module.
What we'd like to do is deploy these wsdl files to a maven repository since the maven repository can act as
a makeshift service repository (such as described here)
give clients an easy way to use the cxf codegen plugin by pointing to the maven coordinates for a wsdl instead of managing the wsdl files themselves
What I've got so far is a pom file that uses dependency:unpack-dependencies to get all of the wsdl files in the project in to one directory within this modules ${project.build.directory} (commonly known as target/ to everyone out there).
What I don't know how to do is to loop through each of these files and invoke deploy:deploy-file mojo on each wsdl. What are my options here since I really want to automate the process of deploying these wsdl files and not have anyone ever deploy them manually?
For completeness sake, here is the pom file:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>rice</artifactId>
<groupId>org.kuali.rice</groupId>
<version>2.0.0-m7-SNAPSHOT</version>
</parent>
<artifactId>rice-dist-wsdl</artifactId>
<name>Rice WSDL Distributions</name>
<packaging>pom</packaging>
<properties>
<wsdl.location>${project.build.directory}/wsdl</wsdl.location>
</properties>
<!-- Depends on all API modules and modules that generate or contain wsdls -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-core-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kew-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kim-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-krms-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-ksb-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-shareddata-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wsdls</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>**\/*.wsdl</includes>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Which shoves the wsdls in target/wsdl (they are contained within wsdl/ inside each .jar being depended upon):
[whaley#sunspot ~/Repositories/Kuali/rice/dist-wsdl]
> find . -iname '*.wsdl' | head -3
./target/wsdl/CampusService.wsdl
./target/wsdl/CountryService.wsdl
./target/wsdl/CountyService.wsdl
Solution
Thought what I implemented was different than the accepted answer provided by Ryan Steward, I accepted his answer since it led me to write my own.
Basically, here is a maven pom that's a submodule in the multi-module project described above. I'm using dependency:unpack-dependencies and then using an in-line groovy script to call deploy:deploy-file on each of those wsdl files. It's a bit of a hackjob, but I couldn't think of a better way to do this without hardcoding paths to the wsdl files in the module and calling several executions of the deploy:deploy-file mojo on them, leading to a very verbose pom.
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>rice</artifactId>
<groupId>org.kuali.rice</groupId>
<version>2.0.0-m7-SNAPSHOT</version>
</parent>
<artifactId>rice-dist-wsdl</artifactId>
<name>Rice WSDL Distributions</name>
<packaging>pom</packaging>
<properties>
<wsdl.location>${project.build.directory}/wsdl</wsdl.location>
</properties>
<!-- Depends on all API modules and modules that generate or contain wsdls -->
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-core-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kew-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-kim-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-krms-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-ksb-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rice-shareddata-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-wsdls</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includes>**\/*.wsdl</includes>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
def repo_url
def repo_id
if ("${project.version}".endsWith("SNAPSHOT")) {
repo_url = "${kuali.repository.snapshot.url}"
repo_id = "${kuali.repository.snapshot.id}"
} else {
repo_url = "${kuali.repository.release.url}"
repo_id = "${kuali.repository.release.id}"
}
def wsdlGroupId = "${project.groupId}.wsdl"
new File("${wsdl.location}").eachFile() { file ->
serviceName = file.name.split("\\.")[0]
log.info("Deploying ${wsdlGroupId}:${serviceName}:wsdl:${project.version} to ${repo_id}")
execString = "mvn deploy:deploy-file -Dfile=${file} -Durl=${repo_url} -DrepositoryId=${repo_id} "
execString += "-DgroupId=${wsdlGroupId} -DartifactId=${serviceName} "
execString += "-Dversion=${project.version} -Dpackaging=wsdl -Dclassifier=wsdl"
def proc = execString.execute()
proc.waitFor()
err = proc.err.text
if (err != null && err.length() > 0) {
log.error(err)
fail("Deployment failed for ${wsdlGroupId}:${serviceName}:wsdl:${project.version} to ${repo_id}. \n Run in verbose mode for full error.")
} else {
log.info("Successfully deployed ${wsdlGroupId}:${serviceName}:wsdl:${project.version} to ${repo_id}")
}
}
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Another possibility: the Maven Ant tasks can deploy files. I've never used it, but I'll bet you could use an antrun configuration and some ant pattern matching to pick up and deploy all the WSDLs.
The Build Helper plugin might help you out. You can make it publish the WSDLs, but you'll have to list each one out explicitly, and they'll all have the artifactId of your pom in their names. Only the classifier can change. For example:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-WSDLs</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/foo.wsdl</file>
<classifier>foo</classifier>
<type>wsdl</type>
</artifact>
<artifact>
<file>${project.build.directory}/bar.wsdl</file>
<classifier>bar</classifier>
<type>wsdl</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
If your pom's coordinate is myGroupId:myArtifactId:1.1.1, then the artifacts installed and deployed using this config would be named myArtifactId-1.1.1-foo.wsdl and myArtifactId-1.1.1-bar.wsdl. That's the best I know of.