使用外部 jar 的打包解析器
我一直在尝试通过创建 packager.xml 文件来下载外部 jar Jsoup。
当我尝试构建文件时,我收到一条错误消息:
“......ivy2\packager\build\org.jsoup\jsoup\1.6.1\packager.xml 不是 有效的 XML 文档”
以下是我在 ivysettings.xml 中所做的更改
<settings defaultResolver="default"/>
<resolvers>
<ibiblio name="default" m2compatible="true"/>
<packager name="packager" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache" preserveBuildDirectories="false">
<ivy pattern="file:///${ivy.settings.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="file:///${ivy.settings.dir}/packager.xml"/>
</packager>
</resolvers>
<modules>
<module organisation="org.jsoup" name="jsoup" resolver="packager"/>
</modules>
,以下是我创建的 packager.xml 文件,
<packager-module version="1.0">
<property name="name" value="${ivy.packager.module}"/>
<property name="version" value="${ivy.packager.revision}"/>
<property name="packagename" value="${name}-${version}"/>
<resource dest="archive" url="http://jsoup.org/$packagename.jar" />
<build>
<move file="archive/${packagename}.jar" tofile="artifacts/jars/${name}.jar"/>
</build>
</packager-module>
错误,
[ivy:resolve] :: org.jsoup#jsoup;1.6.1 : C:\blah....\blah.ivy2\packager\build\org.jsoup\jsoup\1.6.1\packager.xml 不是有效的 XML 文档,
我已经尝试了所有操作 。我可以将其设为有效的 xml 文档,但错误仍然无法恢复......您能否对这个问题提供一些见解,
谢谢。
I've been trying to download an external jar Jsoup by creating a packager.xml file.
When I try to building the file I get back an error which says
".......ivy2\packager\build\org.jsoup\jsoup\1.6.1\packager.xml is not
a valid XML document"
The following are the changes I've made in my ivysettings.xml
<settings defaultResolver="default"/>
<resolvers>
<ibiblio name="default" m2compatible="true"/>
<packager name="packager" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache" preserveBuildDirectories="false">
<ivy pattern="file:///${ivy.settings.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="file:///${ivy.settings.dir}/packager.xml"/>
</packager>
</resolvers>
<modules>
<module organisation="org.jsoup" name="jsoup" resolver="packager"/>
</modules>
the following is the packager.xml file that I created,
<packager-module version="1.0">
<property name="name" value="${ivy.packager.module}"/>
<property name="version" value="${ivy.packager.revision}"/>
<property name="packagename" value="${name}-${version}"/>
<resource dest="archive" url="http://jsoup.org/$packagename.jar" />
<build>
<move file="archive/${packagename}.jar" tofile="artifacts/jars/${name}.jar"/>
</build>
</packager-module>
The error,
[ivy:resolve] :: org.jsoup#jsoup;1.6.1: C:\blah....\blah.ivy2\packager\build\org.jsoup\jsoup\1.6.1\packager.xml is not a valid XML document.
I've tried doing all I could to make it a valid xml document but still the error doesn't revert......Can you please give some insight into this issue.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我已经重现了该错误。
packager.xml 文件未通过 XML 架构验证检查。
在对 packager 解析器 进行故障排除时,我建议设置 < em>preserveBuildDirectories 属性设置为“true”,这使您能够查看生成的中间文件。非常聪明的东西......
修改了打包程序文件
这不是唯一的问题。我最终让打包器按如下方式工作:
打包器实际上是为解开包含 jar 的 tar 或 zip 档案而设计的。这就是为什么我必须重新打包由打包解析器下载的 jar 文件(在上面的示例中)。
观察
您确实知道您根本不需要打包解析器吗? jsoup 可以从 Maven Central 获取吗?我指出这一点是因为您已经有一个 ibilio 解析器在你的ivy设置文件中配置......
如果你真的想要从它的项目主页中获取jsoup,我建议使用更简单的url 解析器
I think I've reproduced the error.
The packager.xml file is failing it's XML schema validation check.
When troubleshooting the packager resolver I'd suggest setting preserveBuildDirectories attribute to "true" which enables you to see the intermediate files generated. Very clever stuff there....
Revised packager file
This is not the only problem. I finally got the packager to work as follows:
The packager is really designed for unwrapping tar or zip archives containing jars. That is why I had to repack the jar file, downloaded by the packager resolver, in the example above.
Observation
You do know that you don't need the packager resolver at all? jsoup is available from Maven Central? I point this out because you already have an ibilio resolver configured in your ivy settings file.....
If you really want jsoup from it's project homepage I'd suggesting using the simpler url resolver
听起来您的 packager.xml 文件包含格式错误的 XML - 它与 Ivy 或 JSoup 无关,问题在于文件本身的格式。
您发布的
packager.xml
片段看起来不错,但我猜它不是整个文件内容。欢迎您在此处发布整个文件。您可以使用支持 XML 的编辑器来了解问题所在,例如 IDE(例如 Eclipse)或独立的 XML 编辑器。
或者,您可以通过反复试验找到有问题的部分:删除文件的一小部分,直到错误消失并找到有问题的行。
It sounds like your
packager.xml
file contains malformed XML - it has nothing to do with Ivy or JSoup, the problem is with the format of the file itself.The snippet of
packager.xml
you posted looks okay, but I'm guessing it's not the whole file contents. You're welcome to post here the whole file.You can use an XML-aware editor in order to understand where the problem is - such as an IDE (e.g. Eclipse) or a standalone XML editor.
Alternatively, you can find the offending section by trial-and-error: remove small portions of the file until the error disappears and you find the offending line.