The web module gathers the static resources and configuration files for building the final web application WAR.
Before you start check out software development building instructions on setting up Elasticsearch.
-
Run embedded Jetty server:
mvn jetty:run -Penv-devThe
env-devprofile above ensures geonetwork runs without a javascript cache allowing testing of changes toweb-ui. -
After a moment, GeoNetwork should be accessible at:
-
Jetty is configured to use
src/main/webappand maven classpath and will reload changes:-
For changes related to the user interface in the
web-uimodule:mvn process-resources -
For changes to schema plugins:
cd ../schemas mvn install cd ../web mvn process-resources -
You may also try the following (which just copies between folders):
mvn process-resources -DschemasCopy=true
-
The build generates, processes and compile files into:
src/main/webapp/WEB-INF/data/config/schema_pluginstarget/
Use mvn clean to remove these files.
In addition running jetty makes use of a database:
~/gn.mv.db~/gn.trace.db*.db(based on geonetwork 3.x use)
Along with data directory and cache, notably:
images/...jcs_caching/...logs/...src/main/webapp/WEB-INF/data/config/schema_plugins/...src/main/webapp/WEB-INF/data/data/...src/main/webapp/WEB-INF/data/wro4j*.dbsrc/main/webapp/WEB-INF/doc/en/...src/main/webapp/WEB-INF/doc/fn/...
Use mvn clean:clean@reset to remove these files.
The web application src/main/webapp contains WEB-INF/data/config/schema_plugins used by the application.
If your plugin is in the schemas folder:
- The
web/pom.xmlis setup to run jetty and automatically include any additional schema plugins in theschemasfolder.
If your plugin is not in the schemas folder:
-
If you are building a metadata101 plugin separately, or working with your own plugin:
cd iso19139.xyz mvn install -
Use
jetty:runwith an additional profile to test your plugin:mvn install -Pschema-iso19139.xyz mvn jetty:run -Pschema-iso19139.xyz -
In the example above the profile
-Pschema-iso19139.xyz:- Includes
schema-iso19139.xyzartifact as a dependency, making the schema plugin bean is available on the CLASSPATH. - Unpacks the
schema-iso19139.xyzartifactpluginfolder intoWEB-INF/data/config/schema_plugins
- Includes
-
The profile can also be used with
process-resourceswhile jetty is running:cd web mvn process-resources -Pschema-iso19139.xyz -
Tip: If work with a set series of plugins you can manage via settings.xml.
The web application src/main/webapp contains WEB-INF/data/config/schema_plugins used by the application.
If your plugin is in the schemas folder:
- The
web/pom.xmlis setup to run jetty and automatically include any additional schema plugins in theschemasfolder.
If your plugin is not in the schemas folder:
-
If you are building a metadata101 plugin separately, or working with your own plugin:
cd iso19139.xyz mvn install -
Use
jetty:runwith an additional profile to test your plugin:mvn install -Pschema-iso19139.xyz mvn jetty:run -Pschema-iso19139.xyz -
In the example above the profile
-Pschema-iso19139.xyz:- Includes
schema-iso19139.xyzartifact as a dependency, making the schema plugin bean is available on the CLASSPATH. - Unpacks the
schema-iso19139.xyzartifactpluginfolder intoWEB-INF/data/config/schema_plugins
- Includes
-
The profile can also be used with
process-resourceswhile jetty is running:cd web mvn process-resources -Pschema-iso19139.xyz -
Tip: If work with a set series of plugins you can manage via settings.xml.
To include your schema plugin in web/pom.xml:
-
Add a profile to
web/pom.xmlunpacking your schema plugin.Use the
iso19115-3.2018as an example, at the time of writing:
<profile> <id>schema-iso19115-xyz</id> <activation> <property><name>schemasCopy</name><value>!true</value></property> <file><exists>../schemas/iso19115-3.2018</exists></file> </activation> <dependencies> <dependency> <groupId>org.geonetwork-opensource.schemas</groupId> <artifactId>schema-iso19139.xyz</artifactId> <version>${project.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>iso19115-xyz-resources</id> <phase>process-resources</phase> <goals><goal>unpack</goal></goals> <configuration> <encoding>UTF-8</encoding> <artifactItems> <artifactItem> <groupId>org.geonetwork-opensource.schemas</groupId> <artifactId>schema-iso19115-xyz</artifactId> <type>zip</type> <overWrite>false</overWrite> <outputDirectory>${schema-plugins.dir}</outputDirectory> </artifactItem> </artifactItems> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile>-
This profile example has several interesting features:
- Activates automatically if the
schemas/iso19115-xyzfolder is present - Disabled if
-DschemasCopy=trueproperty is set - Adds a dependency so that the schema plugin jar is included on the classpath
- Unpacks a
pluginfolder into the webappschema_pluginsfolder
- Activates automatically if the
-
Over time we expect active metadata101 schema plugins be listed.
An alternative approach of copying folders is available using the -DschemasCopy flag:
-DschemasCopy=true: copies folders from../schemaslocation-DschemasCopy=false: default approach, using artifact and maven repository
To add your schema plugin to the schemas-copy profile:
-
Locate the
schemas-copyprofile inweb/pom.xml: -
Add your plugin as a dependency to the profile:
<dependency> <groupId>org.geonetwork-opensource.schemas</groupId> <artifactId>schema-iso19139.xyz</artifactId> <version>${project.version}</version> </dependency>
-
By default each
src/main/pluginfolder inschemasis copied.If your plugin is in not in the
schemasfolder:<resource> <directory>${metadata101}/iso19139.xyz/src/main/plugin</directory> <targetPath>${schema-plugins.dir}</targetPath> </resource>
-
This approach modifies
web/pom.xmlso it can only be recommended in a fork or branch. -
Implementation notes:
-
The
<dependency>added here makes use of a specific verion number. -
If your plugin is inheriting its version number from
schemas/pom.xmlyou may use the propertygn.schemas.version.
-
-
The
add-schema.shscript automates these changes.