IT序号网

eclipse之Maven 2 eclipse

zfyouxi 2024年12月31日 编程语言 26 0

使用maven2eclipse插件,问题是零文档。当我在eclipse的“启用依赖关系管理”中右键单击该项目时,它给了我一个选择,但是除了以下控制台输出外,它还给了我一个相当稀疏的POM.xml:

04/05/11 14:57:54 BST: Generating sources /BenCode/pom.xml 
04/05/11 14:57:54 BST: Build error for /BenCode/pom.xml; org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 
04/05/11 14:57:54 BST: Failed to determine compiler source setting, assuming default 
04/05/11 14:57:54 BST: Failed to determine compiler target setting, assuming default 
04/05/11 14:57:54 BST: Failed to determine compiler source setting, assuming default 
04/05/11 14:57:54 BST: Failed to determine compiler target setting, assuming default 
04/05/11 14:57:54 BST: Failed to determine compiler test inclusions, assuming defaults 
04/05/11 14:57:54 BST: Failed to determine compiler test exclusions, assuming defaults 
04/05/11 14:57:54 BST: Failed to determine compiler inclusions, assuming defaults 
04/05/11 14:57:54 BST: Failed to determine compiler exclusions, assuming defaults 
04/05/11 14:57:54 BST: Refreshing [/BenCode/pom.xml]  

在尝试制定解决方案之前没有使用过Maven就是一个难题。我的印象是,maven应该使用该信息来扫描类路径依赖项来管理项目,但是没有运气:(

请您参考如下方法:

Maven将仅管理POM中指定的依赖关系(以及任何传递性依赖关系(即,您直接定义的依赖关系的依赖关系))。
例如。下面将在测试范围内将JUnit添加为依赖项

<dependencies> 
    <dependency> 
        <groupId>junit</groupId> 
        <artifactId>junit</artifactId> 
        <version>4.8.2</version> 
        <scope>test</scope> 
    </dependency> 
    <!-- ... --> 
</dependencies> 

如果右键单击pom.xml,则可以选择Maven->添加依赖项-这将搜索默认存储库。

另请阅读 Introduction to the Dependency Mechanism


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!