草庐IT

java - Maven cxf-codegen-plugin 不生成源码

coder 2024-03-20 原文

我已经研究了这个问题的其他答案,但我还没有能够解决我的具体问题。我正在尝试使用 Maven 和 cxf-codegen-plugin 生成源客户端 java 文件。当我运行 mvn generate-sources 它告诉我构建成功但没有生成。任何帮助表示赞赏。这是我的 pom:

<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>com.tfs.common</groupId>
  <artifactId>SpringCXF1</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>

  <name>SpringCXF1 Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <properties>
      <cxf.version>2.7.3</cxf.version>
      <project.build.sourceencoding>UTF-8</project.build.sourceencoding>
  </properties>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-frontend-jaxws</artifactId>
       <version>${cxf.version}</version>
    </dependency>

    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-transports-http</artifactId>
       <version>${cxf.version}</version>
    </dependency>

  </dependencies>

  <build>
    <finalName>SpringCXF1</finalName>
      <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>
    </plugin>

       <!-- Generate Java classes from WSDL during in generate-sources phase -->
       <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>
        <executions>
         <execution>
          <id>generate-sources</id>
          <phase>generate-sources</phase>
          <configuration>
           <sourceroot>${basedir}/src/main/java</sourceroot>
           <wsdloptions>
            <wsdloption>
             <wsdl>${basedir}/src/main/resources/HostavailableService.wsdl</wsdl>
             <extraargs>
                 <extraarg>-verbose</extraarg>
                  <extraarg>-client</extraarg>
             </extraargs>
            </wsdloption>
           </wsdloptions>
          </configuration>
          <goals>
           <goal>wsdl2java</goal>
          </goals>
         </execution>
        </executions>
       </plugin>

       <!-- Add generated source -->
       <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>
         <execution>
          <id>add-source</id>
          <phase>generate-sources</phase>
          <goals>
           <goal>add-source</goal>
          </goals>
          <configuration>
           <sources>
             <source>${basedir}/src/main/java</source>
           </sources>
          </configuration>
         </execution>
        </executions>
       </plugin>

        <plugin>
         <groupId>org.eclipse.m2e</groupId>
         <artifactId>lifecycle-mapping</artifactId>
         <version>1.0.0</version>
         <configuration>
          <lifecyclemappingmetadata>
           <pluginexecutions>
            <pluginexecution>
             <pluginexecutionfilter>
              <groupid>org.apache.cxf</groupid>
              <artifactid>cxf-codegen-plugin</artifactid>
              <versionrange>[2.3.3,)</versionrange>
              <goals>
               <goal>wsdl2java</goal>
              </goals>
             </pluginexecutionfilter>
             <action>
              <execute>
             </execute></action>
            </pluginexecution>
           </pluginexecutions>
          </lifecyclemappingmetadata>
          <lifecycleMappingMetadata>
            <pluginExecutions>
                <pluginExecution>
                    <pluginExecutionFilter>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-codegen-plugin</artifactId>
                        <versionRange>[2.7.3,)</versionRange>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </pluginExecutionFilter>
                    <action>
                        <ignore></ignore>
                    </action>
                </pluginExecution>
                <pluginExecution>
                    <pluginExecutionFilter>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>
                            build-helper-maven-plugin
                        </artifactId>
                        <versionRange>[1.7,)</versionRange>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                    </pluginExecutionFilter>
                    <action>
                        <ignore></ignore>
                    </action>
                </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
         </configuration>
        </plugin>
       </plugins>

  </build>

</project>

这是运行 mvn generate-sources 时的输出:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringCXF1 Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- cxf-codegen-plugin:2.7.3:wsdl2java (generate-sources) @ SpringCXF1 ---
[INFO] Nothing to generate
[INFO] 
[INFO] --- build-helper-maven-plugin:1.7:add-source (add-source) @ SpringCXF1 ---
[INFO] Source directory: /Users/dmattrm/Documents/DevEnvironment/TFS_Maven2/SpringCXF1/src/main/java added.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.505s
[INFO] Finished at: Tue Feb 18 16:54:04 CST 2014
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------

最佳答案

CXF 插件的 Maven XML 标签区分大小写,这应该有效:

<configuration>
    <sourceRoot>${basedir}/src/main/java</sourceRoot>
    <wsdlOptions>
        <wsdlOption>
            <wsdl>${basedir}/src/main/resources/HostavailableService.wsdl</wsdl>
            <extraargs>
                <extraarg>-verbose</extraarg>
                <extraarg>-client</extraarg>
            </extraargs>
        </wsdlOption>
    </wsdlOptions>
</configuration>

关于java - Maven cxf-codegen-plugin 不生成源码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21867477/

有关java - Maven cxf-codegen-plugin 不生成源码的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  3. ruby - 如何使用 Ruby aws/s3 Gem 生成安全 URL 以从 s3 下载文件 - 2

    我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A

  4. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  5. ruby-on-rails - Ruby on Rails - 为文本区域和图片生成列 - 2

    我是Rails的新手,所以请原谅简单的问题。我正在为一家公司创建一个网站。那家公司想在网站上展示它的客户。我想让客户自己管理这个。我正在为“客户”生成一个表格,我想要的三列是:公司名称、公司描述和Logo。对于名称,我使用的是name:string但不确定如何在脚本/生成脚手架终端命令中最好地创建描述列(因为我打算将其设置为文本区域)和图片。我怀疑描述(我想成为一个文本区域)应该仍然是描述:字符串,然后以实际形式进行调整。不确定如何处理图片字段。那么……说来话长:我在脚手架命令中输入什么来生成描述和图片列? 最佳答案 对于“文本”数

  6. java - 从 JRuby 调用 Java 类的问题 - 2

    我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www

  7. ruby-on-rails - 如何生成传递一些自定义参数的 `link_to` URL? - 2

    我正在使用RubyonRails3.0.9,我想生成一个传递一些自定义参数的link_toURL。也就是说,有一个articles_path(www.my_web_site_name.com/articles)我想生成如下内容:link_to'Samplelinktitle',...#HereIshouldimplementthecode#=>'http://www.my_web_site_name.com/articles?param1=value1¶m2=value2&...我如何编写link_to语句“alàRubyonRailsWay”以实现该目的?如果我想通过传递一些

  8. java - 我的模型类或其他类中应该有逻辑吗 - 2

    我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我

  9. ruby-on-rails - 如何在 Rails 3 中创建自定义脚手架生成器? - 2

    有这些railscast。http://railscasts.com/episodes/218-making-generators-in-rails-3有了这个,你就会知道如何创建样式表和脚手架生成器。http://railscasts.com/episodes/216-generators-in-rails-3通过这个,您可以了解如何添加一些文件来修改脚手架View。我想把两者结合起来。我想创建一个生成器,它也可以创建脚手架View。有点像RyanBates漂亮的生成器或web_app_themegem(https://github.com/pilu/web-app-theme)。我

  10. java - 什么相当于 ruby​​ 的 rack 或 python 的 Java wsgi? - 2

    什么是ruby​​的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht

随机推荐