I am currently in the process of replacing the IBM WebService framework with Axis2. When generating the code from the WSDL file, I use the Maven plugin WSDL2Code. However, the code created is always wrong. Or rather, the packagenames are always wrong, which in turn makes every method called uncallable (creating even more errors, up to 10.000+ errors in eclipse).
我目前正在使用Axis2替换IBM WebService框架。从WSDL文件生成代码时,我使用Maven插件WSDL2Code。但是,创建的代码总是错误的。或者更确切地说,包名称总是错误的,这反过来使得每个方法都被称为不可调用(在eclipse中创建更多错误,高达10.000+错误)。
Here's an example of what is actually going on (this is just an example I made specifically to get advice):
这是一个实际情况的例子(这只是我专门为获得建议而做的一个例子):
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>Test</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<packageName>test.testpackage</packageName>
<databindingName>xmlbeans</databindingName>
<wsdlFile>${basedir}/wsdl/service.wsdl</wsdlFile>
<outputDirectory>${basedir}/testdirectory</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
In theory, this should generate code with the package name "test.testpackage" in the directory testdirectory/test/testpackage. However, instead it creates the following package: Src.test.testpackage in the directory testdirectory.src.test.testpackage. It always adds a "src" to both package name and directory - if I change the package name to src.test.testpackage, it will generate the following package: src.src.test.testpackage.
理论上,这应该在testdirectory / test / testpackage目录中生成包名为“test.testpackage”的代码。但是,它会在testdirectory.src.test.testpackage目录中创建以下包:Src.test.testpackage。它总是在包名和目录中添加“src” - 如果我将包名更改为src.test.testpackage,它将生成以下包:src.src.test.testpackage。
This, of course, leads to a huge problem, because every generated file has the following error: "The declared package "src.test.testpackage" does not match the expected package "src.src.test.testpackage"
当然,这会导致一个巨大的问题,因为每个生成的文件都有以下错误:“声明的包”src.test.testpackage“与预期的包”src.src.test.testpackage“不匹配”
I'm at a complete loss here. I simply can't find any reason at all why it should add "src" everywhere. I've noticed an auto-generated build.xml file containing a value called sourcedirectory = x/src (or something similar), but there's nothing I can do to affect this value (trying to change it and then save the file makes no difference, obviously, since it's just generated again the next time I run maven).
我在这里完全失败了。我根本找不到任何理由为什么它应该在任何地方添加“src”。我注意到一个自动生成的build.xml文件,其中包含一个名为sourcedirectory = x / src(或类似的东西)的值,但我无法做任何事情来影响这个值(尝试更改它然后保存文件没有区别很明显,因为它是在我下次运行maven时再次生成的。
Oh, and I generally use the command "mvn clean install" and version 1.4.1 of WSDL2Code, so it's not one of the old wsdl2code:wsdl2code bugs.
哦,我通常使用命令“mvn clean install”和WSDL2Code的1.4.1版本,因此它不是旧的wsdl2code:wsdl2code错误之一。
If anyone has any idea of what is actually wrong here, I'd greatly appreciate it.
如果有人知道这里究竟出了什么问题,我会非常感激。
Thanks in advance.
提前致谢。
5 个解决方案
#1
9
Version 1.4.1 has a few more configuration options that are not really documented (have a look at the the source of org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo)...
版本1.4.1还有一些未真正记录的配置选项(请查看org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo的源代码)...
Just use <flattenFiles>true</flattenFiles> - that should solve your problem :-)
只需使用
#2
2
This question is quite old, so I don't know if you're still having the problem...
这个问题已经很老了,所以我不知道你是否还有这个问题......
I would recommend using Axistools Maven Plugin instead, it worked great in our case.
我建议使用Axistools Maven Plugin,它在我们的案例中运作得很好。
#3
0
Maybe 'src' is part of ${basedir} ?
也许'src'是$ {basedir}的一部分?
#4
0
I'm afraid not. Even if it was, the strange problem shouldn't occur then - the path would then be correct being testdirectory/src/test/testpackage, thus causing no problem with the package name. The problem now arises because it is placed in a directory the package does not expect - it expects ${basedir}/testdirectory/insert.package.here.divided.by./, but instead it gets ${basedir}/testdirectory/src/insert.package.here.divided.by./.
恐怕不是。即使是这样,也不应该出现奇怪的问题 - 然后路径将是正确的testdirectory / src / test / testpackage,因此导致包名称没有问题。现在出现问题是因为它被放置在包不期望的目录中 - 它需要$ {basedir} /testdirectory/insert.package.here.divided.by./,而是获得$ {basedir} / testdirectory / src /insert.package.here.divided.by./。
The src should not be present in that part of the path.
src不应出现在路径的该部分中。
#5
0
This is connected with those "genius" of(or user of) maven/axis2 that practically takes decisions for you ... see this: [Axis2 mailing list entry][1]
这与maven / axis2的(或用户)的“天才”有关,它实际上为你做出决定......见:[Axis2邮件列表条目] [1]
[1]: http://markmail.org/search/?q=[Axis2]+indrit#query:[Axis2 Mailing List entry]%20indrit+page:1+mid:a34wbp7l3pljagsz+state:results
[1]:http://markmail.org/search/?q = [Axis2] + indrit #query:[Axis2邮件列表条目]%20indrit + page:1 + mid:a34wbp7l3pljagsz + state:results
#1
9
Version 1.4.1 has a few more configuration options that are not really documented (have a look at the the source of org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo)...
版本1.4.1还有一些未真正记录的配置选项(请查看org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo的源代码)...
Just use <flattenFiles>true</flattenFiles> - that should solve your problem :-)
只需使用
#2
2
This question is quite old, so I don't know if you're still having the problem...
这个问题已经很老了,所以我不知道你是否还有这个问题......
I would recommend using Axistools Maven Plugin instead, it worked great in our case.
我建议使用Axistools Maven Plugin,它在我们的案例中运作得很好。
#3
0
Maybe 'src' is part of ${basedir} ?
也许'src'是$ {basedir}的一部分?
#4
0
I'm afraid not. Even if it was, the strange problem shouldn't occur then - the path would then be correct being testdirectory/src/test/testpackage, thus causing no problem with the package name. The problem now arises because it is placed in a directory the package does not expect - it expects ${basedir}/testdirectory/insert.package.here.divided.by./, but instead it gets ${basedir}/testdirectory/src/insert.package.here.divided.by./.
恐怕不是。即使是这样,也不应该出现奇怪的问题 - 然后路径将是正确的testdirectory / src / test / testpackage,因此导致包名称没有问题。现在出现问题是因为它被放置在包不期望的目录中 - 它需要$ {basedir} /testdirectory/insert.package.here.divided.by./,而是获得$ {basedir} / testdirectory / src /insert.package.here.divided.by./。
The src should not be present in that part of the path.
src不应出现在路径的该部分中。
#5
0
This is connected with those "genius" of(or user of) maven/axis2 that practically takes decisions for you ... see this: [Axis2 mailing list entry][1]
这与maven / axis2的(或用户)的“天才”有关,它实际上为你做出决定......见:[Axis2邮件列表条目] [1]
[1]: http://markmail.org/search/?q=[Axis2]+indrit#query:[Axis2 Mailing List entry]%20indrit+page:1+mid:a34wbp7l3pljagsz+state:results
[1]:http://markmail.org/search/?q = [Axis2] + indrit #query:[Axis2邮件列表条目]%20indrit + page:1 + mid:a34wbp7l3pljagsz + state:results