Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
M2E,并将maven生成的源文件夹作为eclipse源文件夹_Eclipse_Maven_M2eclipse_M2e - Fatal编程技术网

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

M2E,并将maven生成的源文件夹作为eclipse源文件夹,eclipse,maven,m2eclipse,m2e,Eclipse,Maven,M2eclipse,M2e,我在eclipse中有一个maven项目,并且有运行注释处理器以生成代码的maven目标。此代码的输出文件夹是target/generated sources/apt 为了让eclipse看到生成的代码,我需要将target/generated sources/apt作为源文件夹添加到eclipse项目中 但是,这会导致出现“Maven配置问题”类型的错误 pom.xml中的项目配置不是最新的。运行项目 配置更新 我想我理解为什么会这样,因为eclipse的源文件夹集与maven的不同。但是我需

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

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

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

pom.xml中的项目配置不是最新的。运行项目 配置更新

我想我理解为什么会这样,因为eclipse的源文件夹集与maven的不同。但是我需要这个不同的集合,因为我需要eclipse能够看到生成的源文件夹

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


顺便说一句,我已经升级到maven eclipse插件的官方eclipse版本M2E1.0——以前是m2eclipse。我想在返回到旧的m2eclipse版本之前,看看是否可以通过m2e插件找到解决方案。

您需要将源目录与

像这样:


org.codehaus.mojo
)

在M2E1.0中,Maven插件的处理方式发生了变化。您的代码生成插件可能缺少特定的m2e扩展。这是我找到的所有资料


这也可能与此相关。

右键单击错误消息:

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


在“问题”视图中,选择“快速修复”,然后单击“完成”以选择默认的更新项目配置。这就解决了问题。

切换到m2e/maven/apt的新版本后,。。。由于buildhelper添加的buildpath导致了重复的文件,因此我产生了builderrors,因此我需要从buildhelper中删除“apt生成的”文件夹

为了解决Eclipse中的问题,而不是通过M2E中的Update Maven配置添加“apt生成”文件夹,我编写了一个M2E插件来解决这个问题。它将maven apt插件中配置的OutputDirectory添加到项目的构建路径中


您还可以使用discovery目录中提供的buildhelper m2e连接器。我正在使用Eclipse3.7


请求CXF JIRA(请参阅)在CXF codegen插件本身中添加生命周期映射。这将需要m2e 1.1,但我认为这比在cxf项目之外构建连接器更好,假设生命周期映射API的更改频率低于cxf codegen插件和cxf。

面向Web开发人员的Eclipse Java EE IDE。 版本:Juno服务发布1

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

mvn clean install
工作完美

但是在eclipse中,我在Asinc类上有相同的错误


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

这就是我发现使用Spring3.1.1时效果很好的地方,Spring3.1.1中也有3.0.6版本。一旦我得到了插件设置,并将其放入pom的正确区域,包括argline和endorseddir,以便将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>
。。。
.....
....
安逸
org.apache.maven.plugins
maven编译器插件
2.4
1.6
1.6
org.apache.tomcat.maven
tomcat7 maven插件
2
org.apache.maven.plugins
maven编译器插件
目标/生成源/cxf
org.apache.maven.plugins
maven surefire插件
2.12
一旦
-Djava.annowned.dirs=目标/生成源/cxf
org.apache.maven.plugins
maven编译器插件
目标/生成源/cxf
org.apache.maven.plugins
maven surefire插件
一旦
-Djava.annowned.dirs=目标/生成源/cxf
org.apache.maven.plugins
maven依赖插件
javax.xml.bind
jaxb api
2.2
javax.xml.ws
JAXWSAPI
2.2
目标/生成源/cxf
projName
org.apache.cxf
cxf-codegen插件
2.5.2                        
过程源
生成源
一旦
-Djava.annowned.dirs=目标/生成源/cxf
wsdl2java
<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>