简体   繁体   English

我在编写maven项目时遇到了麻烦

[英]I'm having troubles to compile a maven project

I've imported my project into Eclipse (Helios + m2eclipse), and also into Netbeans (7.0) and in both IDEs one of the troubles is: 我已将我的项目导入Eclipse(Helios + m2eclipse),也导入Netbeans(7.0),在两个IDE中,其中一个问题是:

This is what I get in Netbeans when I try to build. 这是我尝试构建时在Netbeans中获得的内容。

The project com.miCompany:myProject:1.0 (.....) has 1 error 项目com.miCompany:myProject:1.0(.....)有1个错误

Unresolveable build extension: Plugin org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.axis2:axis2-wsdl2code-maven-plugin:jar:1.3 (): Failed to read artifact descriptor for org.apache.woden:woden:jar:1.0-incubating-M7b: Could not transfer artifact org.apache.woden:woden:pom:1.0-incubating-M7b from/to jibx (http://jibx.sourceforge.net/maven): No connector available to access repository jibx (http://jibx.sourceforge.net/maven) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 2] 不可解析的构建扩展:插件org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3或其中一个依赖项无法解析:无法收集org.apache.axis2的依赖项:axis2-wsdl2code-maven-plugin:jar :1.3():无法读取org.apache.woden的工件描述符:woden:jar:1.0-incubating-M7b:无法传输工件org.apache.woden:woden:pom:1.0-incubating-M7b from / to jibx (http://jibx.sourceforge.net/maven):没有连接器可用于使用可用工厂WagonRepositoryConnectorFactory访问存储库jibx(http://jibx.sourceforge.net/maven) - > [帮助2]

This is what I get in Eclipse: 这是我在Eclipse中得到的:

Project build error: Unresolveable build extension: Plugin org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.axis2:axis2-wsdl2code-maven-plugin:jar:1.3 () pom.xml /myProject line 1 Maven Problem 项目构建错误:无法解析的构建扩展:插件org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3或其中一个依赖项无法解析:无法收集org.apache.axis2的依赖项:axis2-wsdl2code-maven -plugin:jar:1.3()pom.xml / myProject line 1 Maven问题

In Eclipse I've downloaded this: http://www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.5.4/axis2-eclipse-service-plugin-1.5.4.zip unzipped and copied the file: "org.apache.axis2.eclipse.codegen.plugin_1.5.4.jar" into the directory "plugins" of my Eclipse instalation. 在Eclipse中我已经下载了这个: http//www.apache.org/dyn/mirrors/mirrors.cgi/axis/axis2/java/core/1.5.4/axis2-eclipse-service-plugin-1.5.4。 zip解压缩并将文件:“org.apache.axis2.eclipse.codegen.plugin_1.5.4.jar”复制到我的Eclipse安装目录“plugins”中。 And I still getting the same error. 我仍然得到同样的错误。

I am running Netbeans over Win XP and Eclipse over Win XP and also over Mac, allways the same error. 我在Win XP上运行Netbeans而在Win XP上运行Eclipse,也在Mac上运行Netbeans,总是出现同样的错误。

Does somebody have any idea what can I do? 有人知道我该怎么办?

Here goes my pom.xml 这是我的pom.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>MyParent</artifactId>
    <groupId>com.mycompany</groupId>
    <version>1.0</version>
  </parent>
  <groupId>com.mycompany</groupId>
  <artifactId>myModule</artifactId>
  <version>1.0</version>
  <name>myModule</name>
  <url>http://maven.apache.org</url>

  <build>
    <plugins>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <configuration>
                <filesets>     
                    <fileset>
                        <directory>src/main/java</directory>
                        <includes>
                            <include>com/mycompany/client/*.java</include>
                        </includes>
                    </fileset>
                </filesets>
            </configuration>
        </plugin> 

        <plugin>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
            <version>1.3</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsdl2code</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageName>com.mycompany.client</packageName>
                <wsdlFile>src/main/axis2/MyWsdl.wsdl</wsdlFile>
                <outputDirectory>.</outputDirectory>
                <targetResourcesFolderLocation>target/main/axis2</targetResourcesFolderLocation>
                <targetSourceFolderLocation>src/main/java</targetSourceFolderLocation>
                <namespaceURIs>
                    <namespaceURI>
                        <uri>http://schema.mycompany.com/Esb</uri>
                        <packageName>com.mycompany.services.Esbsrv.schema</packageName>
                    </namespaceURI>
                    <namespaceURI>
                        <uri>http://wsdl.mycompany.com/Esb</uri>
                        <packageName>com.mycompany.services.Esbsrv.schema</packageName>
                    </namespaceURI>
                    <namespaceURI>
                        <uri>http://schema.mycompany.com/Global/WSException</uri>
                        <packageName>com.mycompany.schema.global.wsexception</packageName>
                    </namespaceURI>
                </namespaceURIs>
            </configuration>
        </plugin>

    </plugins>
  </build>

  <dependencies>
  <!-- 
   <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.2</version>
        <scope>compile</scope>
    </dependency>
 -->
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.3</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.3</version>
        <scope>compile</scope>
    </dependency>
<!-- 
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-xmlbeans</artifactId>
        <version>1.3</version>
        <scope>compile</scope>
    </dependency>
   -->
     </dependencies>

</project>

Well, I can only offer suggestions as I"m not much of a maven expert, but I did just have to do this today and it was pretty straightforward for me - 好吧,我只能提供建议,因为我不是一个专家,但我今天必须这样做,这对我来说非常简单 -

  • set up the maven project to be eclipse friendly : mvn eclipse:eclipse 设置maven项目是日食友好: mvn eclipse:eclipse

  • make sure eclipse can see the libs. 确保eclipse可以看到libs。 this meant going to the projectsetup/buildpath/libraries editor in eclipse and adding the variable M2_REPO to point to your local maven repository (eg something like /home/nacho3d/.m2/repository) 这意味着转到eclipse中的projectsetup / buildpath / libraries编辑器并添加变量M2_REPO以指向您当地的maven存储库(例如/home/nacho3d/.m2/repository)

Your error, actually, looks to me like maven can't find a dependency for axis. 实际上,你的错误看起来像maven找不到轴的依赖。 The specifics for that should be on the axis website, 具体内容应该在轴网站上,

I think you're using maven 3.0+, right? 我想你正在使用maven 3.0+,对吧?

That pom(org.apache.woden:woden:jar:1.0-incubating-M7b) isn't compatible with maven 3 yet. 那个pom(org.apache.woden:woden:jar:1.0-incubating-M7b)与maven 3不兼容。 If you use maven 2.2.1 to build ESB 4.3.0-03 source, then it would be successfully. 如果您使用maven 2.2.1构建ESB 4.3.0-03源代码,那么它将成功。

I have also faced the same problem and fixed it by following below step... 我也面临同样的问题并通过以下步骤修复它...

  1. In you project directory do the command: mvn eclipse:eclipse 在你的项目目录中执行命令:mvn eclipse:eclipse
  2. In eclipse project right click->Maven->Update Project. 在eclipse项目中右键单击 - > Maven-> Update Project。
  3. Again right click->Maven->Disable Maven Nature 再次右键单击 - > Maven->禁用Maven Nature
  4. Restart eclipse. 重启eclipse。
  5. Right click on project->Configure->Convert to Maven Project. 右键单击project-> Configure-> Convert to Maven Project。

Finish. 完。 Error will gone. 错误将消失。

Thanks 谢谢

If you have the jar of the missing dependency you can: 如果你有缺少依赖的jar,你可以:

1) deploy it on your maven repository, if you have one 1)将其部署在maven存储库中(如果有的话)

2) declare the dependency in your pom with a scope of 'system': check this out 2)使用'system'范围声明你的pom中的依赖关系: 检查一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM