eclipse:clean eclipse:eclipse - maven 命令用法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17746165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:54:53  来源:igfitidea点击:

eclipse:clean eclipse:eclipse - maven command usage

eclipseweb-servicesmavenm2ewsimport

提问by roger_that

I have a maven project wherein i am consuming a webservice using wsimportas a goal during project build.

我有一个 maven 项目,其中我wsimport在项目构建期间使用作为目标的 web 服务。

<build>
  <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>1.10</version>
            <executions>
                <execution>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                </execution>
            </executions>
            <!-- -->
            <configuration>
                <wsdlUrls>
                    <wsdlUrl>http://localhost:8081/email-service/services/EmailService?wsdl</wsdlUrl>
                </wsdlUrls>
                <sourceDestDir>${project.build.directory}/generated</sourceDestDir>
                <verbose>true</verbose>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
<finalName>EmailServiceClient</finalName>

I build the project using clean installcommand. The artifacts/classes are generated in target->generateddirectory. So far so good.

我使用clean install命令构建项目。工件/类在target->generated目录中生成。到现在为止还挺好。

Now when i tried to access any of the generated class in my srcdirectory, i get compiler error stating that the class is not defined. My peer told me to build the project using

现在,当我尝试访问目录中任何生成的类时src,我收到编译器错误,指出该类未定义。我的同行告诉我使用

eclipse:clean eclipse:eclipse

I did and it solved the problem. I was able to use those generated classes very easily. Now I am wondering

我做到了,它解决了问题。我能够非常轻松地使用这些生成的类。现在我想知道

  • what is actually happening with this command?
  • What is the use?
  • Am i actually following the correct way to consume? I know i can also use wsdl2javabut what is wrong with this?
  • 这个命令实际上发生了什么?
  • 有什么用?
  • 我真的遵循正确的消费方式吗?我知道我也可以使用,wsdl2java但这有什么问题?

Has anyone ever encountered this type of situation? Please throw some light on this. Thank you!

有没有人遇到过这种情况?请对此有所了解。谢谢!

回答by Pulkit

I am not sure the reason behind your problem " when i tried to access any of the generated class in my src directory, i get compiler error stating that the class is not defined. " But I can tell you the meaning of command you are using

我不确定您的问题背后的原因“当我尝试访问我的 src 目录中的任何生成的类时,我收到编译器错误,指出该类未定义。”但我可以告诉您您正在使用的命令的含义

As far as I know in maven we can define more than one goal at a time to execute so

据我所知,在 maven 中我们可以一次定义多个目标来执行

eclipse:clean   \Deletes the .project, .classpath, .wtpmodules files and .settings  folder used by Eclipse.

eclipse:eclipse \build the project into eclipse project like structure.