当从AEM下载时,如何在eclipse中使用捆绑包 [英] How to work with a bundle in eclipse when it was downloaded from AEM
问题描述
我从包管理器 - http:// localhost:4502 / crx / packmgr / index.jsp
的运行的AEM实例下载了一个zip。 zip文件提取时包含 jcr_root
和 META-INF
。
I downloaded a zip from a running instance of AEM from package manager - http://localhost:4502/crx/packmgr/index.jsp
. The zip file, when extracted contains, jcr_root
and META-INF
.
我想在这个zip文件之上构建一些功能。所以我想知道是否有办法在eclipse中使用这个文件?但是,这个zip文件夹中没有 pom.xml
文件。所以我不能只是在Eclipse中导入它。我有为Eclipse下载的AEM开发工具。
I would like to build some functionality on top of this zip file. So I'm wondering if there is a way to work with this file in eclipse? However, there are no pom.xml
files in this zip folder. So I can't just import it in Eclipse. I have AEM developer tools downloaded for Eclipse.
有没有可用的指南说明如何做? zip文件包含一些Java文件,我想对这些Java文件进行更改并重新打包,重新部署,以便我可以测试我的更改。
Is there a guide available that explains how to do this? The zip file contains some Java files and I would like to make changes to those Java files and re-package, re-deploy, so that I can test my changes.
我尝试使用Adobe支架(使用AEM扩展),但它只适用于JS或JSP更改...不适用于JAVA文件。
I tried using Adobe Brackets (with AEM extension) but it only works well for JS or JSP changes...not for JAVA files.
更新
在@ Gabriel的评论之后,这是我对需要从中将
从下载到通过eclipse创建的新项目。
After @Gabriel's comment, this is my understanding of how I need to move around from the package I downloaded to the new project created via eclipse.
执行上述
After doing the above
这是新的eclipse项目在复制/粘贴一切之后的样子
Here is what the new eclipse project looks like after I've copy/pasted everything
已下载包中的filter.xml的内容
Contents of filter.xml from downloaded package
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/etc/designs/delta"/>
<filter root="/apps/delta"/>
<filter root="/content/delta"/>
<filter root="/content/dam/delta"/>
<filter root="/content/usergenerated/content/delta"/>
<filter root="/apps/foundation/components/parsys"/>
</workspaceFilter>
基于上述我在以下位置更改了两个filter.xml
Based on above I changed two filter.xml in following locations
/myproj.ui.apps/src/main/content/META-INF/vault/filter.xml
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/myproject">
<exclude pattern="/apps/myproject/install" />
</filter>
<filter root="/apps/foundation/components/parsys" />
<filter root="/etc/designs/delta"/>
</workspaceFilter>
/myproj.ui.content/src/main/content/META- INF / vault / filter.xml
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content/myproject"/>
<filter root="/content/dam/myproject"/>
<filter root="/content/usergenerated/content/delta"/>
</workspaceFilter>
干净/发布似乎没有任何效果,因为我没有看到CRX或<$执行清理/发布后,c $ c> localhost:4502 / siteadmin 所以我试图手动安装。
Doing clean/publish seemed to have no effect as I didn't see anything in CRX or localhost:4502/siteadmin
after doing clean/publish. So I tried to install manually.
为此我做了运行为 - > maven在myproj上安装(/构建以下zip文件)
For that I did Run as -> Maven Install
on myproj (which builds the following zip files)
~/Documents/workspace/myproj $ tree | grep "zip"
│ ├── myproj.ui.apps-0.0.1-SNAPSHOT.zip
├── myproj.ui.content-0.0.1-SNAPSHOT.zip
当我上传&将这两个文件安装到CRX我看到以下内容:
When I upload & install these two files to CRX I see the following:
然而,这也似乎没有任何效果,因为我在 localhost:4502 / siteadmin
中看不到任何内容,当我访问 localhost:4502 / content / myproj
我收到错误
However, this also seems to not be having any effect because I don't see anything in localhost:4502/siteadmin
and when I visit localhost:4502/content/myproj
I get an error
``
BTW这是我在 localhost:4502 / siteadmin
更新2
再次完成所有操作后,我可以创建eclipse项目,并且在清理/发布方面取得了成功。但是,当我执行清理/发布时,不会反映对JAVA文件的更改。
After going through everything again I was able to create the eclipse project and was successful in clean/publishing. However, changes to JAVA files aren't being reflected when I do clean/publish.
@Gabriel提到,
@Gabriel mentioned that
对于Java包的PROJECT.core(这些将变得有趣,只要
,因为你想添加Java代码)
PROJECT.core for Java bundles (these will become interesting as soon as you want to add Java code)
我有java文件已经在 PROJECT.ui.apps
如下图所示
I have java files already that are in PROJECT.ui.apps
as shown in the image below
如果我修改这个JAVA文件并清理/发布,我的更改不会反映在AEM中。还有什么需要做的,以便能够更改和发布JAVA代码?或者如何更改JAVA文件并在AEM上进行测试?
If I make a change to this JAVA file and clean/publish, my changes aren't being reflected in AEM. Is there something else that needs to be done to be able to change and publish JAVA code? or How can I make changes to JAVA files and test that on AEM?
推荐答案
您可以使用新建项目功能创建您的正确结构:
You can use the New Project feature to create the right structure for you:
- 在Eclipse中,执行文件> 新建> 项目...
- 选择 AEM > AEM示例多模块项目> strong>
- 选择最新的原型版本
- 输入名称,组ID 和 Artefact Id > Next
- 如果已经有添加到现有服务器,然后选择位置,否则选择设置新服务器并填写所有字段> 完成
- 等待Eclipse完成设置所有的一切
- In Eclipse do File > New > Project...
- Choose AEM > AEM Sample Multi-Module Project > Next
- Pick the latest Archetype version
- Enter the Name, Group Id, and Artefact Id > Next
- Either Add to existing server if there's already one and pick the Location, else choose Setup new server and fill all fields > Finish
- Wait for Eclipse to finish setting up everything
您现在有为您创建的以下项目,这将允许健康分离f关注:
You now have following projects created for you, which will allow healthy separation of concerns:
-
PROJECT.ui.apps
for/ apps
和/ etc
内容 -
PROJECT.ui.content
for
/ content
这是创作 -
PROJECT.core
用于Java捆绑包(一旦您要添加Java代码,这些将变得有趣) -
PROJECT.it.launcher
和PROJECT.it.tests
进行集成测试(只要不执行任何集成测试,就可以忽略这些)
PROJECT.ui.apps
for/apps
and/etc
contentPROJECT.ui.content
for/content
that is authoredPROJECT.core
for Java bundles (these will become interesting as soon as you want to add Java code)PROJECT.it.launcher
andPROJECT.it.tests
for integration tests (you can ignore these as long as you don't run any integration tests)
首先,使用应用程序$ c $替换
PROJECT.ui.apps
项目的内容c>和等
包裹的文件夹:
First, replace the content of your PROJECT.ui.apps
project with the apps
and etc
folders of your package:
- 在项目资源管理器面板,展开
PROJECT.ui.apps
>src
>main
>内容
>jcr_root
>apps
- 右键单击
apps
文件夹,然后选择显示在 > 系统消费者 - 删除
应用程序
和等
您现在应该看到的文件夹,并在这里放置您的内容包应用程序
和等
/ li>
- 在Eclipse中,右键单击
PROJECT.ui.apps
项目,然后选择刷新
- In the Project Explorer panel, unfold
PROJECT.ui.apps
>src
>main
>content
>jcr_root
>apps
- Right-click on the
apps
folder and choose Show In > System Exporer - Delete the
apps
andetc
folders that you should now be seeing and place here theapps
andetc
folders of your of your content package - In Eclipse, right-click on the
PROJECT.ui.apps
project and choose Refresh
然后对 PROJECT.ui.content
执行相同操作,并替换为内容
文件夹与您的一个包:
Then do the same for the PROJECT.ui.content
and replace it's content
folder with the one of your package:
- 在项目资源管理器面板,展开
PROJECT.ui.content
>src
>main
>内容
>jcr_root
>内容
li>
- 右键点击更深入的
内容
文件夹,然后选择显示在> 系统支出者
- 删除您现在应该看到的
内容
文件夹,并将其放在这里内容
您的内容包的文件夹
- 在Eclipse中,右键单击
PROJECT.ui.content
项目,然后选择刷新
- 右键点击更深入的
- In the Project Explorer panel, unfold
PROJECT.ui.content
>src
>main
>content
>jcr_root
>content
- Right-click on the deeper
content
folder and choose Show In > System Exporer - Delete the
content
folder that you should now be seeing and place here thecontent
folder of your of your content package - In Eclipse, right-click on the
PROJECT.ui.content
project and choose Refresh
现在您必须更新 filter.xml
这两个项目的文件对应于您的内容包的内容。
为此,请在单独的文本/代码编辑器中打开您的内容包的 META-INF / vault / filter.xml
文件。
Now you have to update the filter.xml
files of these two projects to correspond to the content of your content package.
For that, open the META-INF/vault/filter.xml
file of your content package in a separate text/code editor.
这是您的 filter.xml
文件可以查看的示例:
This is an example of how your filter.xml
file can look:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/foo"/>
<filter root="/apps/foundation/components/bar"/>
<filter root="/etc/designs/foo"/>
<filter root="/content/foo"/>
<filter root="/content/dam/foo"/>
<filter root="/content/usergenerated/content/foo"/>
</workspaceFilter>
对于分成两个项目的包的内容,您还需要拆分这些过滤器规则分为两个,并相应更新两个项目的 filter.xml
文件。
As for the content of your package that got split into two projects, you'll also have to split these filter rules into two and update accordingly the filter.xml
files of the two projects.
- 在Eclipse中,打开
PROJECT.ui.apps / src / main / content / META-INF / filter.xml
- 将
< workspaceFilter>
元素的内容替换为以/ apps
和/ etc
- 然后打开
PROJECT.ui.content / src / main / content / META-INF / filter。 xml
- 将规则替换为以
/ content
开头的包
- In Eclipse, open
PROJECT.ui.apps/src/main/content/META-INF/filter.xml
- Replace the content of the
<workspaceFilter>
element with the rules of your package that start with/apps
and/etc
- Then open
PROJECT.ui.content/src/main/content/META-INF/filter.xml
- Replace the rules with the ones of your package that start with
/content
基于上述示例,这是 filter.xml
的 PROJECT.ui.apps
将看起来:
Based on the above example, this is how the filter.xml
of PROJECT.ui.apps
would look:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/foo"/>
<filter root="/apps/foundation/components/bar"/>
<filter root="/etc/designs/foo"/>
</workspaceFilter>
而 PROJECT.ui.content
:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content/foo"/>
<filter root="/content/dam/foo"/>
<filter root="/content/usergenerated/content/foo"/>
</workspaceFilter>
确保保存所有更改。您现在应该完成,并且可以将该新内容同步到您的AEM实例。
Make sure to Save all your changes. You should now be done, and can synchronize that new content to your AEM instance.
- 在服务器面板中,请确保您的连接是
[已启动]
,如果不启动 - 单击清除和发布图标(最后一个)
- In the Servers panel, make sure that your connection is
[Started]
, and if not start it - Click on the Clean and Publish icon (the last one)
完成后,您应该在您的实例上运行包,并保存,任何更改会自动与实例同步。
Once done, you should have your package running on your instance, and on save, any change automatically get synchronized to the instance.
如果您希望从项目中重新构建一个包:
If you wish to re-build a package out of your project:
- 右键单击
PROJECT.ui.apps
或PROJECT.ui.content
并选择运行方式> Maven安装 - 您现在有一个
目标
文件夹已经用你的软件包创建(称为例如PROJECT.ui.apps-0.0.1-SNAPSHOT.zip
)。
- Right-click on the
PROJECT.ui.apps
orPROJECT.ui.content
and choose Run As > Maven Install - You now have a
target
folder that has been created with your package inside (called for e.g.PROJECT.ui.apps-0.0.1-SNAPSHOT.zip
).
这篇关于当从AEM下载时,如何在eclipse中使用捆绑包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!