在 Eclipse 中使用 maven android 原型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6735562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using maven android archetype with eclipse
提问by dewijones92
I am trying to use the following archetype. https://github.com/akquinet/android-archetypes/wiki/Android-release-archetype
我正在尝试使用以下原型。 https://github.com/akquinet/android-archetypes/wiki/Android-release-archetype
I can follow the instructions on the page fine (using the terminal)
I was wondering, how do I do this in Eclipse? Is there a sort of command line interface I can input the required commands?
i.e
我可以按照页面上的说明(使用终端)
我想知道,我如何在 Eclipse 中执行此操作?是否有一种命令行界面可以输入所需的命令?IE
mvn archetype:generate \
-DarchetypeArtifactId=android-release \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.0.5 \
-DgroupId=com.foo.bar \
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android
Thanks
谢谢
回答by crowne
- Install m2eclipseplugin
- create new maven project
- next button takes you to archetype selection
- optionally configure archetype catalogues, shouldn't be necessary for this archetype (android-release), as the latest version 1.0.5 is in the central maven repo.
- next, next, next ...
- 安装m2eclipse插件
- 创建新的 Maven 项目
- 下一个按钮带您进入原型选择
- 可选地配置原型目录,对于这个原型(android-release)应该不是必需的,因为最新版本 1.0.5 在中央 maven repo 中。
- 下一个,下一个,下一个……
Update:
更新:
To get it working I did the following:
为了让它工作,我做了以下事情:
- download http://repo1.maven.org/maven2/archetype-catalog.xmlsave it as user-home/.m2/central-archetype-catalog.xml
- in eclipse create new maven project
- next button
- configure catalogs, add new local catalog point to file created in step 1.
- after closing the catalog configuration dialog, make sure that the drop-down catalog selector is on all catalogs or on the new local catalog that you just defined
- in the filter type 'android-release'
- select the android-release archetype and click next
- enter your selected group-id and artifact-id
- 下载http://repo1.maven.org/maven2/archetype-catalog.xml保存为 user-home/.m2/central-archetype-catalog.xml
- 在eclipse中创建新的maven项目
- 下一个按钮
- 配置目录,将新的本地目录点添加到步骤 1 中创建的文件。
- 关闭目录配置对话框后,确保下拉目录选择器位于所有目录或您刚刚定义的新本地目录上
- 在过滤器类型“android-release”中
- 选择 android-release 原型,然后单击下一步
- 输入您选择的组 ID 和工件 ID
I did notice a problem reported that the project directory could not be renamed.
The project had been created on disk, so I imported it into eclipse using
Import > Maven > Existing maven projects
我确实注意到一个报告项目目录无法重命名的问题。
该项目已在磁盘上创建,因此我使用
Import > Maven > Existing maven projects将其导入 eclipse
回答by Ricardo Gladwell
If you are starting with a new project you can use the Maven Android archetypes to create Android projects completely within Eclipse you just need to do the following:
如果您从一个新项目开始,您可以使用 Maven Android 原型在 Eclipse 中完全创建 Android 项目,您只需要执行以下操作:
- Create a new Maven Project (File-> New-> Project...then select Maven-> Maven Project).
- When prompted to Select Archetypeclick Add Archetype...
- In the dialog that appears enter "de.akquinet.android.archetypes" for Archetype Group Id.
- In Archetype Artifact Identer "android-quickstart".
- In Archetype Versionenter "1.0.6" and continue.
- When prompted enter your desired project group and artifact ID, version and, optionally, set the "platform" property for the Android version (defaults to '7').
- Set the "android-plugin-version" property for the Android version to '3.0.0'.
- Click Finish
- Right-click on new project and select Maven -> Update Project Configuration.
- 创建一个新的 Maven 项目(File-> New-> Project...然后选择 Maven-> Maven Project)。
- 当提示选择原型时,单击添加原型...
- 在出现的对话框中,为Archetype Group Id输入“de.akquinet.android.archetypes” 。
- 在Archetype Artifact Id 中输入“android-quickstart”。
- 在原型版本中输入“1.0.6”并继续。
- 出现提示时,输入所需的项目组和工件 ID、版本,并可选择设置 Android 版本的“平台”属性(默认为“7”)。
- 将 Android 版本的“android-plugin-version”属性设置为“3.0.0”。
- 单击完成
- 右键单击新项目并选择 Maven -> 更新项目配置。