M2E并将maven生成的源文件夹作为eclipse源文件夹

时间:2023-01-25 14:24:05

I have a maven project in eclipse and have maven goals that run annotation processors to generate code. The output folder for this code is target/generated-sources/apt.

我在eclipse中有一个maven项目,并且有maven目标运行注释处理器来生成代码。此代码的输出文件夹是target / generated-sources / apt。

In order for eclipse to see this generated code I need to add target/generated-sources/apt as a source folder to the eclipse project.

为了让eclipse看到这个生成的代码,我需要将target / generated-sources / apt作为源文件夹添加到eclipse项目中。

However, this causes there to be an error of type "Maven Configuration Problem" saying

但是,这会导致出现“Maven配置问题”类型的错误

Project configuration is not up-to-date with pom.xml. Run project configuration update

项目配置与pom.xml不同步。运行项目配置更新

I think I understand why this is the case as eclipse has a different set of source folders to maven's set. But I need this different set, as I need eclipse to be able to see the generated source folders...

我想我明白为什么会这样,因为eclipse有一组不同的源文件夹到maven的集合。但我需要这个不同的设置,因为我需要eclipse才能看到生成的源文件夹...

When doing a pure maven built, these source folders will be included in the build, by maven.

在构建纯maven时,这些源文件夹将由maven包含在构建中。

btw, I have upgraded to the official eclipse release of the maven eclipse plugin, m2e 1.0 - what used to be m2eclipse. I'd like to see if I can find a work around/solution to this with the m2e plugin before I have to go back to the old m2eclipse version.

顺便说一句,我已升级到maven eclipse插件的官方eclipse版本,m2e 1.0 - 曾经是m2eclipse。在我不得不回到旧的m2eclipse版本之前,我想看看我是否可以使用m2e插件找到解决方案/解决方案。

11 个解决方案

#1


101  

You need to attach the source directory with the build-helper-plugin.

您需要使用build-helper-plugin附加源目录。

Like so:

像这样:

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${project.build.directory}/generated-sources/java/</source>
                </sources>
            </configuration>
        </execution>
    </executions>
 </plugin>

You will also need to:

您还需要:

  • Install the "Apt M2E Connector" from the Eclipse Marketplace. To do so click the error in the Overview tab of your pom.xml and select "Discover".
  • 从Eclipse Marketplace安装“Apt M2E Con​​nector”。为此,请单击pom.xml的Overview选项卡中的错误,然后选择“Discover”。
  • Ensure there are no plugin execution filters for the build-helper-maven-plugin (see https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html)
  • 确保build-helper-maven-plugin没有插件执行过滤器(请参阅https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html)

#2


79  

Right-click the Error message:

右键单击错误消息:

Project configuration is not up-to-date with pom.xml Run project configuration update

使用pom.xml运行项目配置更新时项目配置不是最新的

in the Problems View and select Quick Fix and click Finish to select the default Update project configuration. This fixes it.

在Problems View中,选择Quick Fix并单击Finish选择默认的Update project配置。这解决了它。

#3


4  

After switching to new versions of m2e/maven/apt,... i had builderrors because of the duplicated files, caused by the added buildpath by the buildhelper, so i needed to remove the "apt-generated"-Folders from the buildhelper.

切换到m2e / maven / apt的新版本后,...由于buildhelper添加的构建路径导致重复文件,我有构建器错误,所以我需要从buildhelper中删除“apt-generated”-Folders。

To fix the Problem in Eclipse, not adding the "apt-generated"-folder via Update Maven Configuration in M2E, i've written a M2E Plugin to fix this problem. It adds the outputDirectories configured in the maven-apt-plugin to the buildpath of the Project.

为了解决Eclipse中的问题,不通过M2E中的Update Maven配置添加“apt-generated”文件夹,我编写了一个M2E插件来解决这个问题。它将maven-apt-plugin中配置的outputDirector添加到Project的构建路径中。

https://apt-m2e.googlecode.com

https://apt-m2e.googlecode.com

#4


3  

In m2e 1.0 the handling of Maven plugins has changed. You might be lacking a specific m2e extension for your code generating plugin. Here is all the documentation I managed to find.

在m2e 1.0中,Maven插件的处理已经改变。您的代码生成插件可能缺少特定的m2e扩展。这是我设法找到的所有文档。

This bug report may also be relevant.

此错误报告也可能是相关的。

#5


1  

https://bugs.eclipse.org/bugs/show_bug.cgi?id=350081

https://bugs.eclipse.org/bugs/show_bug.cgi?id=350081

request on CXF JIRA (see 1) to add lifecycle mappings in the cxf-codegen-plugin itself. This would require m2e 1.1 but I believe it is better approach than having connectors built outside of cxf project, assuming that lifecycle mapping API would change less frequently than cxf-codegen-plugin and cxf.

在CXF JIRA(请参阅1)上请求在cxf-codegen-plugin本身中添加生命周期映射。这将需要m2e 1.1,但我相信这是比在cxf项目之外构建连接器更好的方法,假设生命周期映射API的变化频率低于cxf-codegen-plugin和cxf。

#6


0  

You can also use the buildhelper m2e connector available in the discovery catalog. I'm using Eclipse 3.7

您还可以使用发现目录中提供的buildhelper m2e连接器。我正在使用Eclipse 3.7

#7


0  

Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1

面向Web开发人员的Eclipse Java EE IDE。版本:Juno Service Release 1

mvn archetype:generate \
   -DarchetypeGroupId=org.codehaus.mojo \
   -DarchetypeArtifactId=gwt-maven-plugin \
   -DarchetypeVersion=2.5.0

mvn clean install

work perfectly.

工作完美。

But in eclipse I have the same error on Asinc class.

但是在eclipse中我对Asinc类有同样的错误。

Just press F5 on project. Fix this problem.

只需在项目上按F5即可。解决这个问题。

#8


0  

This was what I found that worked good using spring 3.1.1 which does have the 3.0.6 version as well in it. Once I got the plugins setup and put into the correct area of the pom and included the argline and endorseddirs to have the java sources put out into the target/generated-sources/cxf folder then maven generated the sources ok.

这是我发现使用弹簧3.1.1工作得很好,它也有3.0.6版本。一旦我获得插件设置并放入pom的正确区域并包括argline和endorseddirs将java源放入target / generated-sources / cxf文件夹,然后maven生成源ok。

....

....

 <properties>...

   <dependencyManagement>
      <dependencies>.....
   </dependencyManagement>

<dependencies>
   <dependency>....

</dependencies>



<!-- *************************** Build process ************************************* -->
<build>
    <finalName>eSurety</finalName>
    <plugins>
        <!-- Force Java 6 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <!-- Deployent on AS from console
        <plugin>
            <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>${version.jboss.as.maven.plugin}</version>
        </plugin>
        -->

        <!-- wildbill added tomcat plugin -->
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>              
        </plugin>

        <!-- Surefire plugin before 2.9 version is buggy. No need to declare here,
              it's being referenced below w/ the version
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
        </plugin>
        -->

        <!-- developer added these -->   
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArguments>
                    <endorseddirs>target/generated-sources/cxf</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <forkMode>once</forkMode>
                <argLine>-Djava.endorsed.dirs=target/generated-sources/cxf</argLine>
            </configuration>
        </plugin>           
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArguments>
                    <endorseddirs>target/generated-sources/cxf</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <forkMode>once</forkMode>
                <argLine>-Djava.endorsed.dirs=target/generated-sources/cxf</argLine>
            </configuration>
        </plugin>                       
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>                       
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.2</version>
                    </artifactItem>
                    <artifactItem>
                        <groupId>javax.xml.ws</groupId>
                        <artifactId>jaxws-api</artifactId>
                        <version>2.2</version>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>target/generated-sources/cxf</outputDirectory>
            </configuration>                      
        </plugin>                                                 
    </plugins>
</build>



<!-- *********************** Profiles ************************************ -->
<profiles>
    <profile>
        <!-- When built in OpenShift the 'openshift' profile will be 
            used when invoking mvn. -->
        <!-- Use this profile for any OpenShift specific customization 
            your app will need. -->
        <!-- By default that is to put the resulting archive into the 
            'deployments' folder. -->
        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
        <id>projName</id>
        <build>
            <plugins>                                                   
                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>2.5.2</version>                        
                    <executions>
                        <execution>
                            <id>process-sources</id>
                            <phase>generate-sources</phase>                                                                                               
                            <configuration>
                                <fork>once</fork>
                                <additionalJvmArgs>-Djava.endorsed.dirs=target/generated-sources/cxf</additionalJvmArgs>                                          
                            </configuration>
                            <goals>                             
                                <goal>wsdl2java</goal>
                            </goals>
                        </execution>
                    </executions>                       
                    <dependencies>
                        <dependency>
                           <groupId>com.sun.xml.bind</groupId>
                           <artifactId>jaxb-impl</artifactId>
                           <version>2.2</version>
                        </dependency>
                        <dependency>
                           <groupId>com.sun.xml.bind</groupId>
                           <artifactId>jaxb-xjc</artifactId>
                           <version>2.2</version>
                        </dependency>
                     </dependencies>
                </plugin>

                <!-- Actual war created in default target dir -->
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.2</version>                                               
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

If your wsdl folder is in ${basedir}/src/main/resources it'll find it automatically

如果你的wsdl文件夹在$ {basedir} / src / main / resources中,它会自动找到它

Hope this helps! ~wildbill

希望这可以帮助! 〜wildbill

#9


0  

In case for some reason you can't use the build helper plugin the easiest way (albeit not as convenient and somewhat tedious) I have found to deal with this is:

如果由于某种原因你不能使用构建助手插件最简单的方法(虽然不方便,有点乏味),我发现处理这个是:

  1. Separate the generated source code into its own project or sub module.
  2. 将生成的源代码分离到自己的项目或子模块中。
  3. You will want to keep this project predominately closed or not imported into Eclipse when you are working on the parent project.
  4. 在处理父项目时,您将希望保持此项目主要关闭或不导入到Eclipse中。
  5. In the parent project that needs the generated code make sure to now depend on the generated source code project via Maven pom dependency.
  6. 在需要生成代码的父项目中,确保现在依赖于通过Maven pom依赖项生成的源代码项目。
  7. When you need to update the generated code go to the generated code project and run mvn install. Now refresh the parent project by right clicking and selecting Maven->Update Project...
  8. 当您需要更新生成的代码时,请转到生成的代码项目并运行mvn install。现在通过右键单击并选择Maven-> Update Project来刷新父项目...

This generally works well for projects that use a semi static source for code generation such as SOAP WSDLs (Apache CXF) or code generated from a database (jOOQ). For APT and other AspectJ-like-code it doesn't work as well because you are editing the source frequently.

这通常适用于使用半静态源代码生成的项目,如SOAP WSDL(Apache CXF)或从数据库生成的代码(jOOQ)。对于APT和其他类似AspectJ的代码,它不能正常工作,因为您经常编辑源代码。

#10


-1  

the configuration to the build helper plugin did work for us.

构建帮助程序插件的配置确实对我们有用。

but be aware, that the destination folder always has to be equal to the configuration of the plugin u're using for the annotation processing itself.

但请注意,目标文件夹始终必须等于您用于注释处理本身的插件的配置。

for example the maven-processor-plugin uses the target folder ${project.build.directory}/generated-sources/apt as default. if you wish another destination for your generated source files you can set it by the tag as shown below.

例如,maven-processor-plugin使用目标文件夹$ {project.build.directory} / generated-sources / apt作为默认值。如果您希望生成的源文件的其他目的地,您可以通过标签设置它,如下所示。

<plugin>
<groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <version>2.1.1</version>
                <executions>
                    <execution>
                        <id>process</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <defaultOutputDirectory>apt_generated</defaultOutputDirectory>
                            <processors>
                                <processor>com.any.processor.invoker</processor>
                            </processors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

#11


-3  

Here is the solution

这是解决方案

  1. Open Marker View (Window > Show View
  2. 打开标记视图(窗口>显示视图
  3. Right-click on the Error message
  4. 右键单击错误消息
  5. Select Quick Fix
  6. 选择快速修复
  7. Click Finish
  8. 单击完成

#1


101  

You need to attach the source directory with the build-helper-plugin.

您需要使用build-helper-plugin附加源目录。

Like so:

像这样:

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${project.build.directory}/generated-sources/java/</source>
                </sources>
            </configuration>
        </execution>
    </executions>
 </plugin>

You will also need to:

您还需要:

  • Install the "Apt M2E Connector" from the Eclipse Marketplace. To do so click the error in the Overview tab of your pom.xml and select "Discover".
  • 从Eclipse Marketplace安装“Apt M2E Con​​nector”。为此,请单击pom.xml的Overview选项卡中的错误,然后选择“Discover”。
  • Ensure there are no plugin execution filters for the build-helper-maven-plugin (see https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html)
  • 确保build-helper-maven-plugin没有插件执行过滤器(请参阅https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html)

#2


79  

Right-click the Error message:

右键单击错误消息:

Project configuration is not up-to-date with pom.xml Run project configuration update

使用pom.xml运行项目配置更新时项目配置不是最新的

in the Problems View and select Quick Fix and click Finish to select the default Update project configuration. This fixes it.

在Problems View中,选择Quick Fix并单击Finish选择默认的Update project配置。这解决了它。

#3


4  

After switching to new versions of m2e/maven/apt,... i had builderrors because of the duplicated files, caused by the added buildpath by the buildhelper, so i needed to remove the "apt-generated"-Folders from the buildhelper.

切换到m2e / maven / apt的新版本后,...由于buildhelper添加的构建路径导致重复文件,我有构建器错误,所以我需要从buildhelper中删除“apt-generated”-Folders。

To fix the Problem in Eclipse, not adding the "apt-generated"-folder via Update Maven Configuration in M2E, i've written a M2E Plugin to fix this problem. It adds the outputDirectories configured in the maven-apt-plugin to the buildpath of the Project.

为了解决Eclipse中的问题,不通过M2E中的Update Maven配置添加“apt-generated”文件夹,我编写了一个M2E插件来解决这个问题。它将maven-apt-plugin中配置的outputDirector添加到Project的构建路径中。

https://apt-m2e.googlecode.com

https://apt-m2e.googlecode.com

#4


3  

In m2e 1.0 the handling of Maven plugins has changed. You might be lacking a specific m2e extension for your code generating plugin. Here is all the documentation I managed to find.

在m2e 1.0中,Maven插件的处理已经改变。您的代码生成插件可能缺少特定的m2e扩展。这是我设法找到的所有文档。

This bug report may also be relevant.

此错误报告也可能是相关的。

#5


1  

https://bugs.eclipse.org/bugs/show_bug.cgi?id=350081

https://bugs.eclipse.org/bugs/show_bug.cgi?id=350081

request on CXF JIRA (see 1) to add lifecycle mappings in the cxf-codegen-plugin itself. This would require m2e 1.1 but I believe it is better approach than having connectors built outside of cxf project, assuming that lifecycle mapping API would change less frequently than cxf-codegen-plugin and cxf.

在CXF JIRA(请参阅1)上请求在cxf-codegen-plugin本身中添加生命周期映射。这将需要m2e 1.1,但我相信这是比在cxf项目之外构建连接器更好的方法,假设生命周期映射API的变化频率低于cxf-codegen-plugin和cxf。

#6


0  

You can also use the buildhelper m2e connector available in the discovery catalog. I'm using Eclipse 3.7

您还可以使用发现目录中提供的buildhelper m2e连接器。我正在使用Eclipse 3.7

#7


0  

Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1

面向Web开发人员的Eclipse Java EE IDE。版本:Juno Service Release 1

mvn archetype:generate \
   -DarchetypeGroupId=org.codehaus.mojo \
   -DarchetypeArtifactId=gwt-maven-plugin \
   -DarchetypeVersion=2.5.0

mvn clean install

work perfectly.

工作完美。

But in eclipse I have the same error on Asinc class.

但是在eclipse中我对Asinc类有同样的错误。

Just press F5 on project. Fix this problem.

只需在项目上按F5即可。解决这个问题。

#8


0  

This was what I found that worked good using spring 3.1.1 which does have the 3.0.6 version as well in it. Once I got the plugins setup and put into the correct area of the pom and included the argline and endorseddirs to have the java sources put out into the target/generated-sources/cxf folder then maven generated the sources ok.

这是我发现使用弹簧3.1.1工作得很好,它也有3.0.6版本。一旦我获得插件设置并放入pom的正确区域并包括argline和endorseddirs将java源放入target / generated-sources / cxf文件夹,然后maven生成源ok。

....

....

 <properties>...

   <dependencyManagement>
      <dependencies>.....
   </dependencyManagement>

<dependencies>
   <dependency>....

</dependencies>



<!-- *************************** Build process ************************************* -->
<build>
    <finalName>eSurety</finalName>
    <plugins>
        <!-- Force Java 6 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <!-- Deployent on AS from console
        <plugin>
            <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>${version.jboss.as.maven.plugin}</version>
        </plugin>
        -->

        <!-- wildbill added tomcat plugin -->
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>              
        </plugin>

        <!-- Surefire plugin before 2.9 version is buggy. No need to declare here,
              it's being referenced below w/ the version
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
        </plugin>
        -->

        <!-- developer added these -->   
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArguments>
                    <endorseddirs>target/generated-sources/cxf</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <forkMode>once</forkMode>
                <argLine>-Djava.endorsed.dirs=target/generated-sources/cxf</argLine>
            </configuration>
        </plugin>           
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArguments>
                    <endorseddirs>target/generated-sources/cxf</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <forkMode>once</forkMode>
                <argLine>-Djava.endorsed.dirs=target/generated-sources/cxf</argLine>
            </configuration>
        </plugin>                       
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>                       
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.2</version>
                    </artifactItem>
                    <artifactItem>
                        <groupId>javax.xml.ws</groupId>
                        <artifactId>jaxws-api</artifactId>
                        <version>2.2</version>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>target/generated-sources/cxf</outputDirectory>
            </configuration>                      
        </plugin>                                                 
    </plugins>
</build>



<!-- *********************** Profiles ************************************ -->
<profiles>
    <profile>
        <!-- When built in OpenShift the 'openshift' profile will be 
            used when invoking mvn. -->
        <!-- Use this profile for any OpenShift specific customization 
            your app will need. -->
        <!-- By default that is to put the resulting archive into the 
            'deployments' folder. -->
        <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
        <id>projName</id>
        <build>
            <plugins>                                                   
                <plugin>
                    <groupId>org.apache.cxf</groupId>
                    <artifactId>cxf-codegen-plugin</artifactId>
                    <version>2.5.2</version>                        
                    <executions>
                        <execution>
                            <id>process-sources</id>
                            <phase>generate-sources</phase>                                                                                               
                            <configuration>
                                <fork>once</fork>
                                <additionalJvmArgs>-Djava.endorsed.dirs=target/generated-sources/cxf</additionalJvmArgs>                                          
                            </configuration>
                            <goals>                             
                                <goal>wsdl2java</goal>
                            </goals>
                        </execution>
                    </executions>                       
                    <dependencies>
                        <dependency>
                           <groupId>com.sun.xml.bind</groupId>
                           <artifactId>jaxb-impl</artifactId>
                           <version>2.2</version>
                        </dependency>
                        <dependency>
                           <groupId>com.sun.xml.bind</groupId>
                           <artifactId>jaxb-xjc</artifactId>
                           <version>2.2</version>
                        </dependency>
                     </dependencies>
                </plugin>

                <!-- Actual war created in default target dir -->
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.2</version>                                               
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

If your wsdl folder is in ${basedir}/src/main/resources it'll find it automatically

如果你的wsdl文件夹在$ {basedir} / src / main / resources中,它会自动找到它

Hope this helps! ~wildbill

希望这可以帮助! 〜wildbill

#9


0  

In case for some reason you can't use the build helper plugin the easiest way (albeit not as convenient and somewhat tedious) I have found to deal with this is:

如果由于某种原因你不能使用构建助手插件最简单的方法(虽然不方便,有点乏味),我发现处理这个是:

  1. Separate the generated source code into its own project or sub module.
  2. 将生成的源代码分离到自己的项目或子模块中。
  3. You will want to keep this project predominately closed or not imported into Eclipse when you are working on the parent project.
  4. 在处理父项目时,您将希望保持此项目主要关闭或不导入到Eclipse中。
  5. In the parent project that needs the generated code make sure to now depend on the generated source code project via Maven pom dependency.
  6. 在需要生成代码的父项目中,确保现在依赖于通过Maven pom依赖项生成的源代码项目。
  7. When you need to update the generated code go to the generated code project and run mvn install. Now refresh the parent project by right clicking and selecting Maven->Update Project...
  8. 当您需要更新生成的代码时,请转到生成的代码项目并运行mvn install。现在通过右键单击并选择Maven-> Update Project来刷新父项目...

This generally works well for projects that use a semi static source for code generation such as SOAP WSDLs (Apache CXF) or code generated from a database (jOOQ). For APT and other AspectJ-like-code it doesn't work as well because you are editing the source frequently.

这通常适用于使用半静态源代码生成的项目,如SOAP WSDL(Apache CXF)或从数据库生成的代码(jOOQ)。对于APT和其他类似AspectJ的代码,它不能正常工作,因为您经常编辑源代码。

#10


-1  

the configuration to the build helper plugin did work for us.

构建帮助程序插件的配置确实对我们有用。

but be aware, that the destination folder always has to be equal to the configuration of the plugin u're using for the annotation processing itself.

但请注意,目标文件夹始终必须等于您用于注释处理本身的插件的配置。

for example the maven-processor-plugin uses the target folder ${project.build.directory}/generated-sources/apt as default. if you wish another destination for your generated source files you can set it by the tag as shown below.

例如,maven-processor-plugin使用目标文件夹$ {project.build.directory} / generated-sources / apt作为默认值。如果您希望生成的源文件的其他目的地,您可以通过标签设置它,如下所示。

<plugin>
<groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <version>2.1.1</version>
                <executions>
                    <execution>
                        <id>process</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <defaultOutputDirectory>apt_generated</defaultOutputDirectory>
                            <processors>
                                <processor>com.any.processor.invoker</processor>
                            </processors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

#11


-3  

Here is the solution

这是解决方案

  1. Open Marker View (Window > Show View
  2. 打开标记视图(窗口>显示视图
  3. Right-click on the Error message
  4. 右键单击错误消息
  5. Select Quick Fix
  6. 选择快速修复
  7. Click Finish
  8. 单击完成