venkatReddi
venkatReddi

Reputation: 163

In Hybirs how to import a class which is in one extension to another

I am working on a internal app in Hybris. Like HMC. I have create an extension and added the required extensions in the extensioninfo.xml, but when I am trying to import a bean in those required extensions, I am seeing class cannot be resolved. I have cleaned the project. But I am unable to resolve this issue. Can someone guide me. I can provide more details on request.

<extensioninfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="extensioninfo.xsd">

   <extension abstractclassprefix="Generated" classprefix="Sma" managername="SmaManager" managersuperclass="de.hybris.platform.jalo.extension.Extension" name="sma" usemaven="false">
      <!-- for more information on maven managed libraries please consult https://wiki.hybris.com/x/Nq8sDQ -->

      <!-- you should add all required extensions to this list, except platform extensions which are automatically required -->         
      <!-- <requires-extension name="cms"/> -->         

        <requires-extension name="services"/>
      <coremodule generated="true" manager="com.company.sma.jalo.SmaManager" packageroot="com.company.sma"/>

      <webmodule jspcompile="false" webroot="/sma"/>

   </extension>

</extensioninfo>

Upvotes: 3

Views: 4677

Answers (2)

HybrisHelp
HybrisHelp

Reputation: 5810

[yjavac] 1. ERROR cannot be resolved to a type in Hybris?

Extensions can have dependencies on one another. The build only works if the required extension is available.

Ensure the below steps to works it smoothly.


Dependencies to Non-Platform(not located in /platform/ext) Extension

  • The required extension should be there in localextensions.xml
  • Add the required extension in extensioninfo.xml (e.g <requires-extension name="hmc"/>) of the dependent extension
  • In your eclipse(IDE), add required extension in build path of the dependent extension to resolve IDE dependecy.

    Note: Adding required extension in IDE build path won't resolve extension dependency of your platform. It only resolved by extensioninfo.xml

  • Rebuild the system (ant clean all)


Dependencies to Platform Extension

By default, all extensions have the dependency on Platform extension(located at /platform/ext). Therefore, you do not required to specify requires-extension for the Platform extensions in extensioninfo.xml file.


Source Post

Upvotes: 0

Nomade
Nomade

Reputation: 1748

In the extensioninfo.xml file, we add only the extension dependencies. So, when you add a new Hybris extension, you need to add it to your localextensions.xml file, required extensions too. Don't miss that :

All extensions located in ${HYBRIS_BIN_DIR}/platform/ext are automatically loaded, no need to add them to localextensions.xml file.

Then, ant clean all will build your extensions ressources.

If you cannot resolve your extentions in the IDE, you need to add them to the build path manually.

Upvotes: 7

Related Questions