How to port a Plugin from basic Entando to mavenized Entando - EntandoOldVersions/Entando GitHub Wiki

How to port a Plugin from basic Entando to mavenized Entando

Use case

Port jpuserreg to mavenized jpuserreg

  1. Have the project entando-plugins-parent
  2. Check the dependencies: if jpuserreg depends on another Plugin which is yet-to-be-ported, port that other Plugin first.
  3. Create a new maven module project under entando-plugins-parent
    • Call it entando-plugin-jppuserreg
    • Use the entando-archetype-plugin-generic archetype
    • groupId : org.entando.entando.plugins
    • artifactId : entando-plugin-jpuserreg
    • package : com.agiletec.plugins.jpuserreg
    • Configure the two additional properties:
      • pluginCode : jpuserreg
      • pluginName : User Registration
    • Now check the entando-plugins-parent/pom.xml.
      Find:
<modules>
.....
     <module>entando-plugin-jpuserreg</module>
.....
</modules>
  1. Place all the files from the basic Entando Plugin, into the proper places of the mavenized one, and do some minor adjustments:
Place here This
src/main/java/com/agiletec/plugins/jpuserreg src/com/agiletec/plugins/jpuserreg/**
src/main/resources/entando-struts-plugin.xml the contents of src/jpuserreg_japs-struts-plugin.xml
src/main/resources/api/plugins/jpuserreg/aps WebContent/WEB-INF/plugins/jpuserreg/aps/api/apiMethods.xml
src/main/resources/shortcuts/plugins/jpuserreg/apsadmin WebContent/WEB-INF/plugins/jpuserreg/apsadmin/shortcuts.xml
src/main/resources/spring/plugins/jpuserreg/aps/ WebContent/WEB-INF/plugins/jpuserreg/conf/**
src/main/resources/spring/plugins/jpuserreg/apsadmin WebContent/WEB-INF/plugins/jpuserreg/apsadmin/conf/**
src/main/resource/sql/plugins/jpuserreg/port_data_production.sql the contents of docs/jpuserreg/sql/mysql/portScript.sql with the exclusion of the table creation queries
src/mainresource/sql/plugins/jpuserreg/serv_data_production.sql the contents of docs/jpuserreg/sql/mysql/servScript.sqlwith the exclusion of the table creation queries
src/main/tld/plugins/jpuserreg WebContent/WEB-INF/plugins/jpuserreg/aps/tld/* and WebContent/WEB-INF/plugins/jpuserreg/apsadmin/tld/*
src/main/webapp/resources/plugins/jpuserreg WebContent/resources/plugins/jpuserreg/**
src/main/webapp/WEB-INF/plugins/jpuserreg WebContent/WEB-INF/plugins/jpuserreg/** excluding the Spring files, the api directory, all the tld files and the file shortcuts.xml, placed elsewhere in one of the previous steps
src/test/java/com/agiletec/plugins/jpuserreg test/com/agiletec/plugins/jpuserreg/** changing all the packages and imports from test.com.agiletec... to com.agiletec..., using the base test cases and config utils auto-generated by the archetype, and changing all the extends accordingly.
Plus, if there are any old paths buried somewhere in the sources, change them accordingly.
Example: admin/test/somefile.png may have become target/test/somefile.png.
src/test/resource/sql/plugins/jpuserreg/port_data_test.sql the contents of docs/jpuserreg/sql/mysql/portTestScript.sqlonce again, the queries which create tables must be excluded
src/test/resource/sql/plugins/jpuserreg/serv_data_test.sql the contents of docs/jpuserreg/sql/mysql/servTestScript.sqlwith the exclusion of the table creation queries
src/test/sql/postgresql/port.sql the contents of docs/jpuserreg/sql/postgresql/portTestScript.sql
src/test/sql/postgresql/serv.sql the contents of docs/jpuserreg/sql/postgresql/servTestScript.sql
5. Update all the JSPs, changing the references to taglibs like: `[...omitted..]taglib prefix="jacmswpsa" uri="/WEB-INF/plugins/jacms/apsadmin/tld/jacms-apsadmin-core.tld"[...omitted..]` into references to taglibs like: `[...omitted..]taglib prefix="jacmswpsa" uri="/jacms-apsadmin-core"[...omitted..]`. Make sure to repeat for every taglib used in the JSPs. I myself did this well with Eclipse built-in search and replace tool. 6. Nice. Now update again all the JSPs. No, seriously. Your goal is to change all the occurences of `wpsf:` to `wpsf: useTabindexAutoIncrement="true"` **EXCEPT FOR** `wpsf:hidden` 7. Open the `pom.xml` of `entando-plugin-jpuserreg` and edit: * take a look to the _basic_ Plugin, in `lib/jpuserreg`: if there are any libs, then add them to the `pom.xml` as dependencies * take a look wherever one goes to take a look at this, find out if `entando-plugin-jpuserreg` depends on other Plugins, and add them as dependencies. You must add all of the following for every Plugin (do not copy-paste blindly. Check the version, at least): ```xml org.entando.entando.plugins entando-plugin-jpmail 0.0.1-SNAPSHOT war org.entando.entando.plugins entando-plugin-jpmail 0.0.1-SNAPSHOT jar classes provided org.entando.entando.plugins entando-plugin-jpmail 0.0.1-SNAPSHOT jar tests test ``` 8. Done! Go try some mvn commands :)
⚠️ **GitHub.com Fallback** ⚠️