在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:38:17  来源:igfitidea点击:

Using maven android archetype with eclipse

androideclipsemavenmaven-archetype

提问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

  1. Install m2eclipseplugin
  2. create new maven project
  3. next button takes you to archetype selection
  4. 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.
  5. next, next, next ...
  1. 安装m2eclipse插件
  2. 创建新的 Maven 项目
  3. 下一个按钮带您进入原型选择
  4. 可选地配置原型目录,对于这个原型(android-release)应该不是必需的,因为最新版本 1.0.5 在中央 maven repo 中。
  5. 下一个,下一个,下一个……

Update:

更新:

To get it working I did the following:

为了让它工作,我做了以下事情:

  1. download http://repo1.maven.org/maven2/archetype-catalog.xmlsave it as user-home/.m2/central-archetype-catalog.xml
  2. in eclipse create new maven project
  3. next button
  4. configure catalogs, add new local catalog point to file created in step 1.
  5. 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
  6. in the filter type 'android-release'
  7. select the android-release archetype and click next
  8. enter your selected group-id and artifact-id
  1. 下载http://repo1.maven.org/maven2/archetype-catalog.xml保存为 user-home/.m2/central-archetype-catalog.xml
  2. 在eclipse中创建新的maven项目
  3. 下一个按钮
  4. 配置目录,将新的本地目录点添加到步骤 1 中创建的文件。
  5. 关闭目录配置对话框后,确保下拉目录选择器位于所有目录或您刚刚定义的新本地目录上
  6. 在过滤器类型“android-release”中
  7. 选择 android-release 原型,然后单击下一步
  8. 输入您选择的组 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 项目,您只需要执行以下操作:

  1. Create a new Maven Project (File-> New-> Project...then select Maven-> Maven Project).
  2. When prompted to Select Archetypeclick Add Archetype...
  3. In the dialog that appears enter "de.akquinet.android.archetypes" for Archetype Group Id.
  4. In Archetype Artifact Identer "android-quickstart".
  5. In Archetype Versionenter "1.0.6" and continue.
  6. When prompted enter your desired project group and artifact ID, version and, optionally, set the "platform" property for the Android version (defaults to '7').
  7. Set the "android-plugin-version" property for the Android version to '3.0.0'.
  8. Click Finish
  9. Right-click on new project and select Maven -> Update Project Configuration.
  1. 创建一个新的 Maven 项目(File-> New-> Project...然后选择 Maven-> Maven Project)。
  2. 当提示选择原型时,单击添加原型...
  3. 在出现的对话框中,为Archetype Group Id输入“de.akquinet.android.archetypes” 。
  4. Archetype Artifact Id 中输入“android-quickstart”。
  5. 原型版本中输入“1.0.6”并继续。
  6. 出现提示时,输入所需的项目组和工件 ID、版本,并可选择设置 Android 版本的“平台”属性(默认为“7”)。
  7. 将 Android 版本的“android-plugin-version”属性设置为“3.0.0”。
  8. 单击完成
  9. 右键单击新项目并选择 Maven -> 更新项目配置。