hybris's maven doesn't download transitive dependencies

巧了我就是萌 提交于 2019-12-06 03:06:27

SAP Hybris 6.4+

Yes, you can do this in by overwriting the maven.download.options parameter in an extension project.properties file. It's default value is equal to:

-DoverWriteReleases=true -DoverWriteSnapshots=true -DoverWriteIfNewer=true -DexcludeTransitive=true

If you add to your extension project.properties the line:

maven.download.options=-DoverWriteReleases=true -DoverWriteSnapshots=true -DoverWriteIfNewer=true

SAP Hybris platform will download all dependencies (also transitive). Of course this change will work only for your extension (please don't change content of the project.properties file located in core extensions).


SAP Hybris 6.3 and older

Exclusion of the transitive dependencies is hardcoded in the hybris/bin/platform/resources/ant/mavenTasks.xml file (macro updateLibFolder). The only possible solution is to do a patch in SAP Hybris platform. You can change this code:

<artifact:mvn pom="@{dependencyFile}" fork="true" failonerror="true" mavenVersion="3.2.5">
    <arg value="dependency:copy-dependencies" />
    <arg value="-DoutputDirectory=@{libfolder}" />
    <arg value="-DoverWriteReleases=true" />
    <arg value="-DoverWriteSnapshots=true" />
    <arg value="-DoverWriteIfNewer=true" />
    <arg value="-DexcludeTransitive=true" />
</artifact:mvn>

to:

<artifact:mvn pom="@{dependencyFile}" fork="true" failonerror="true" mavenVersion="3.2.5">
    <arg line="dependency:copy-dependencies -DoutputDirectory=@{libfolder} ${maven.download.options}" />
    <jvmarg line="${env.MAVEN_OPTS} ${env.JAVA_OPTS}" />
</artifact:mvn>

next define a property

maven.download.options=-DoverWriteReleases=true -DoverWriteSnapshots=true -DoverWriteIfNewer=true

in the hybris/bin/platform/project.properties and finally do steps from the solution for 6.4+.


Warning: SAP Hybris platform provides a lot of libraries, so probably some of your transitive dependencies are already available. That is the reason, why downloading of the transitive dependencies are disabled. I think it is a good idea to specify them manually instead of downloading everything (you will avoid problems with the differences of the version).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!