简体   繁体   English

m2e和Maven配置文件

[英]m2e and Maven profiles

I have setup a Maven profile following the advice on the Maven Site 我已经按照Maven网站上的建议设置了Maven配置文件

<activeProfiles>
     <activeProfile>awayFromArchiva</activeProfile>
</activeProfiles>

Now I can use this profile to stop errors during the build when Maven tries to download from an Archiva repository that is not available. 现在,当Maven尝试从不可用的Archiva存储库中下载文件时,我可以使用此配置文件来停止构建过程中的错误。 I can compile on the command line successfully. 我可以在命令行上成功编译。 Using the command line I get 使用命令行我得到

[INFO] Unable to find resource 'xyz' in repository central (http://repo1.maven.org/maven2)

during the successful build. 在成功构建期间。 A similar message is given in Eclipse but thrown as an error. 在Eclipse中给出了类似的消息,但作为错误抛出。

The profile does work as expected since the Archiva instance specified in my settings.xml for a different profile is ignored but the same goals produce very different results. 该配置文件确实按预期工作,因为我在settings.xml为其他配置文件指定的Archiva实例将被忽略,但相同的目标会产生非常不同的结果。

How can you ensure that m2e behaves the same as mvn on the command line? 如何确保m2e行为与命令行上的mvn相同?

In eclipse go to Windows -> Preferences -> Maven -> User Settings and change your user settings to point to your local settings.xml which your command prompt maven use. 在Eclipse中,转到Windows -> Preferences -> Maven -> User Settings然后更改用户设置以指向命令提示符maven使用的本地settings.xml

Eclipse m2e uses embedded maven installation, you can point your eclipse to use your local maven installation. Eclipse m2e使用嵌入式maven安装,您可以将Eclipse指向使用本地maven安装。

Hope it helps. 希望能帮助到你。

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

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