[ 
https://issues.apache.org/jira/browse/CXF-7067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15522802#comment-15522802
 ] 

Atle Tokle commented on CXF-7067:
---------------------------------

I debugged this to fail in org.apache.cxf.maven_plugin.AbstractCodegenMoho

I changed the code as shown below, and it works OK. I don't know maven 
repository lookup, so must be checked that it does not cause other errors. And 
the return-statement need to handle null, empty and multiple artifacts in 
collection.

What I see is that the mavenSession.getLocalRepository() only return one 
repositoty central. Not our local repository nexus. When run with only central, 
the result have originatingArtifact=null and 1 artifact in missingArtifacts.

When I use mavenSession.getTopLevelProject().getRemoteArtifactRepositories() I 
get both central and nexus. The result still have null in originatingArtifact 
and missingArtifacts is null. But now the artifacts list got 1 artifact, and 
when returning that my project builds OK.
{code}
    private Artifact resolveArbitraryWsdl(Artifact artifact) {
        ArtifactResolutionRequest request = new ArtifactResolutionRequest();
        request.setArtifact(artifact);
        request.setResolveRoot(true).setResolveTransitively(false);
        request.setServers(mavenSession.getRequest().getServers());
        request.setMirrors(mavenSession.getRequest().getMirrors());
        request.setProxies(mavenSession.getRequest().getProxies());
        request.setLocalRepository(mavenSession.getLocalRepository());
        // 
request.setRemoteRepositories(mavenSession.getRequest().getRemoteRepositories());
        
request.setRemoteRepositories(mavenSession.getTopLevelProject().getRemoteArtifactRepositories());
        ArtifactResolutionResult result = repositorySystem.resolve(request);
        return result.getArtifacts().iterator().next();
        // return result.getOriginatingArtifact();
    }
{code}

> cxf-codegen-plugin version 3.1.x fails to download wsdlArtifact
> ---------------------------------------------------------------
>
>                 Key: CXF-7067
>                 URL: https://issues.apache.org/jira/browse/CXF-7067
>             Project: CXF
>          Issue Type: Bug
>          Components: Build system
>    Affects Versions: 3.1.0, 3.1.7
>            Reporter: Atle Tokle
>
> I am upgrading my project from using cxf version 3.0.1 to 3.1.7. And have my 
> wsdl's in maven. But it fails to download. Have tested that all 3.0.x 
> versions is OK, but 3.1.7 (and 3.1.0) both fails.
> Plugin is configured like this:
> {code}
>             <plugin>
>                 <groupId>org.apache.cxf</groupId>
>                 <artifactId>cxf-codegen-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <id>generate-sources1</id>
>                         <phase>generate-sources</phase>
>                         <configuration>
>                             <wsdlOptions>
>                                 <wsdlOption>
>                                     <wsdlArtifact>
>                                         
> <groupId>no.xxxxxxx.kontrakter.tjeneste.felles.kontekst</groupId>
>                                         
> <artifactId>soapheaderswrapper</artifactId>
>                                         <version>4.8.0</version>
>                                     </wsdlArtifact>
>                                 </wsdlOption>
>                             </wsdlOptions>
>                         </configuration>
>                         <goals>
>                             <goal>wsdl2java</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> {code}
> When it runs, it logs this:
> {code}
> [INFO] 
> [INFO] --- cxf-codegen-plugin:3.1.7:wsdl2java (generate-sources1) @ 
> iamhelper-domain-gen ---
> Downloading: 
> http://repo.maven.apache.org/maven2/no/xxxxxxx/kontrakter/tjeneste/felles/kontekst/soapheaderswrapper/4.8.0/soapheaderswrapper-4.8.0.wsdl
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 2.455s
> [INFO] Finished at: Fri Sep 23 09:41:00 CEST 2016
> [INFO] Final Memory: 13M/300M
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.cxf:cxf-codegen-plugin:3.1.7:wsdl2java (generate-sources1) on 
> project soapheaders-domain-gen: Failed to resolve WSDL artifact 
> no.xxxxxxx.kontrakter.tjeneste.felles.kontekst:soapheaderswrapper:wsdl:4.8.0 
> -> [Help 1]
> [ERROR] 
> {code}
> The same run on 3.0.x version output this:
> {code}
> [INFO] 
> [INFO] --- cxf-codegen-plugin:3.0.10:wsdl2java (generate-sources1) @ 
> iamhelper-domain-gen ---
> [INFO] Resolved WSDL artifact to file 
> C:\Users\atokle.AD-ONE\.m2\repository\no\xxxxxxx\kontrakter\tjeneste\felles\kontekst\soapheaderswrapper\4.8.0\soapheaderswrapper-4.8.0.wsdl
> [INFO] 
> no.xxxxxxx.kontrakter.tjeneste.felles.kontekst:soapheaderswrapper:wsdl:4.9.0:compile
>  resolved to 
> C:\Users\atokle.AD-ONE\.m2\repository\no\xxxxxxx\kontrakter\tjeneste\felles\kontekst\soapheaderswrapper\4.9.0\soapheaderswrapper-4.9.0.wsdl
> [INFO] Resolved WSDL artifact to file 
> C:\Users\atokle.AD-ONE\.m2\repository\no\xxxxxxx\kontrakter\tjeneste\felles\kontekst\soapheaderswrapper\4.9.0\soapheaderswrapper-4.9.0.wsdl
> [INFO] 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to