[
https://issues.apache.org/jira/browse/CXF-6420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14556519#comment-14556519
]
Andreas Panagiotidis edited comment on CXF-6420 at 5/22/15 6:01 PM:
--------------------------------------------------------------------
I have downloaded the source code of cxf-java2ws-plugin plugin and I have
prepared a code fix, which is rather simple.
In the Java2WSMojo class, line ~440
{code}
// Attach the generated wsdl file to the artifacts that get deployed
// with the enclosing project
if (attachWsdl && outputFile != null) {
File wsdlFile = new File(outputFile);
if (wsdlFile.exists()) {
if (classifier != null) {
projectHelper.attachArtifact(project, "wsdl", classifier,
wsdlFile);
} else {
projectHelper.attachArtifact(project, "wsdl", wsdlFile);
}
}
}
{code}
Replace with the following.
{code}
if (wsdlFile.exists()) {
if (classifier != null) {
projectHelper.attachArtifact(project, wsdlFile.getName(),
classifier, wsdlFile);
} else {
projectHelper.attachArtifact(project, wsdlFile.getName(),
wsdlFile);
}
}
{code}
The interpretation is also simple. When attaching the WSDL files in the local
repository, the plugin names the after their service name too.
{code}
.
{code}
If the responsible(s) of the project agree with the fix, I would very much like
to commit the change.
was (Author: apanag):
I have downloaded the plugin and I have prepared a code fix, which is rather
simple.
In the Java2WSMojo class, line ~440
{code}
// Attach the generated wsdl file to the artifacts that get deployed
// with the enclosing project
if (attachWsdl && outputFile != null) {
File wsdlFile = new File(outputFile);
if (wsdlFile.exists()) {
if (classifier != null) {
projectHelper.attachArtifact(project, "wsdl", classifier,
wsdlFile);
} else {
projectHelper.attachArtifact(project, "wsdl", wsdlFile);
}
}
}
{code}
Replace with the following.
{code}
if (wsdlFile.exists()) {
if (classifier != null) {
projectHelper.attachArtifact(project, wsdlFile.getName(),
classifier, wsdlFile);
} else {
projectHelper.attachArtifact(project, wsdlFile.getName(),
wsdlFile);
}
}
{code}
If the responsible(s) of the project agree with the fix, I would very much like
to commit the change.
> Maven cxf-java2ws-plugin copies to the maven repository only the last wsdl of
> multiple services/executions - overwrites the others
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-6420
> URL: https://issues.apache.org/jira/browse/CXF-6420
> Project: CXF
> Issue Type: Improvement
> Components: Build system
> Affects Versions: 3.1.0
> Environment: in all environments, version
> Reporter: Andreas Panagiotidis
> Labels: easyfix
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I use the Maven *cxf-java2ws-plugin* to generate WSDLs from @WebService
> annotated Java classes.
> For each Service, we have to create an execution in the plugin, according to
> this link
> http://mail-archives.apache.org/mod_mbox/cxf-users/201003.mbox/%[email protected]%3E
> . I also did not find another possibility.
> By default in the latest version of cxf-java2ws-plugin the configuration
> parameter "attachWsdl" is true.
> That means that the plugin generates a WSDL for *each* execution.
> Unfortunately, the plugin during the maven install phase copies each
> generated WSDL to the local repository to the directory:
> {code}
> maven-local-repository\[groupId]\[version]\[artifactId]-[version].wsdl
> {code}
> The naming of the file is the reason that maven does not copy to a local all
> the WSDLs . Only the one of the last execution of the plugin get's copied.
> Maven overwrites the previous.
> Equally important, Maven version 3.3.3 does not allow to release the Maven
> project. (Maven 3.0.5 had a different process)
> The maven deploy plugin during the release uploads to the enterprise
> repository the first generated WSDL successfully. But then it goes to upload
> the WSDL from second execution, but that already exists in the Maven
> Enterprise Repository. Thus, the project cannot upload the WSDLs.
> We may set the attachWsdl option to false, but this is not a solution, as for
> some the goal is to *deploy* the WSDL files.
> I attach a zip with a maven project that demonstrates the issue.
> You see that the plugin copies in the local repository only the last WSDL
> file, instead of generating once for each execution.
> {code}
> [INFO]
> [INFO] --- maven-install-plugin:2.3.1:install (default-install) @
> test-cxf-with-deploy-plugin ---
> [INFO] Installing
> C:\test-cxf-with-deploy-plugin\target\test-cxf-with-deploy-plugin-1.0.jar to
> C:\\m3-repository\ch\apanag\test-cxf-with-deploy-plugin\1.0\test-cxf-with-deploy-plugin-1.0.jar
> [INFO] Installing C:\test-cxf-with-deploy-plugin\pom.xml to
> C:\eplatform\lib\m3-repository\ch\apanag\test-cxf-with-deploy-plugin\1.0\test-cxf-with-deploy-plugin-1.0.pom
> [INFO] Installing
> C:\test-cxf-with-deploy-plugin\target\generated\wsdl\MyService.wsdl to
> C:\m3-repository\ch\apanag\test-cxf-with-deploy-plugin\1.0\test-cxf-with-deploy-plugin-1.0.wsdl
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> {code}
> Deploying a release version to a Maven Enterprise Repository throws an HTML
> 400 error, as normally a release repository does not allow the redeployment
> of file.
> In the end of the day, the plugin does not allow to copy to a repository each
> WSDL. This is against to what it promotes and what its goal was.
> A simple change is the solution. Add in the name of each generated WSDL the
> name of the Service that it represents too.
> {code}
> maven-local-repository\[groupId]\[version]\[artifactId]-[version].[service-name].wsdl
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)