Skip to content

Latest commit

 

History

History
97 lines (76 loc) · 3.54 KB

README.md

File metadata and controls

97 lines (76 loc) · 3.54 KB

CLARIN SRU/FCS Endpoint Archetype

The easiest way to use this archetype is by cloning this git repository, installing the archetype in your local maven repository and then generating your project. But you can also configure your maven to use custom remote repositories if you need to generate projects in the future again.

(a) Install into Local Maven Repository

# optionally run before
#git clone https://github.com/clarin-eric/fcs-endpoint-archetype.git
#cd fcs-endpoint-archetype

mvn clean install "archetype:update-local-catalog"

(b) Using the remote CLARIN Maven Repository/Nexus

With a custom repository, you need to update your local maven settings (can be found at ~/.m2/settings.xml) to include the CLARIN Nexus for archetype discovery and download.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <profiles>
    <profile>
      <!-- id for our custom profile (not active by default) -->
      <id>clarin</id>
      ...
      <repositories>
        <repository>
          <id>CLARIN-Snapshot</id>
          <url>https://nexus.clarin.eu/content/repositories/clarin-snapshot</url>
        </repository>
        <repository>
          <id>CLARIN</id>
          <url>https://nexus.clarin.eu/content/repositories/Clarin</url>
        </repository>
        <!-- add repository for archetypes -->
        <repository>
          <id>archetype</id>
          <url>https://nexus.clarin.eu/content/repositories/Clarin</url>
        </repository>
      </repositories>
      ...
    </profile>
  </profiles>
  ...
</settings>

See:

Create a new FCS Endpoint Project

Now that your Maven can find the archetype definition, you can start the project generation:

mvn archetype:generate \
    -Pclarin \
    -DarchetypeGroupId=eu.clarin.sru.fcs \
    -DarchetypeArtifactId=fcs-endpoint-archetype \
    -DarchetypeVersion=1.6.0 \
    -DgroupId=[ id.group.fcs ] \
    -DartifactId=[ my-cool-endpoint ] \
    -Dversion=[ 1.0-SNAPSHOT ] \
    -DinstitutionName=[ My Institution ]

The values for artifactIdCamelCase and package are used internally and should be kept as is. The Parameter classnamePrefix will be used as prefix for the generated class names: classnameEndpointSearchEngine, classnameSRUSearchResultSet and classnameConstants.

We use -Pclarin to select our clarin profile where the archetype repository is defined (to force select our remote repository instead of central).

Note that depending on the <version> in pom.xml and how you installed the Maven repository you should use -DarchetypeVersion=1.6.0 or -DarchetypeVersion=1.6.0-SNAPSHOT!


Update Archetype and Test

Install into local repository, and then test:

mvn archetype:generate \
    -DarchetypeGroupId=eu.clarin.sru.fcs \
    -DarchetypeArtifactId=fcs-endpoint-archetype \
    -DarchetypeVersion=1.6.0-SNAPSHOT \
    -DarchetypeCatalog=local \
    ...

Install to Remote Repository (only CLARIN developers)

Check that the pom.xml contains the <distributionManagement> section, and that the matching repository id is configured in the global ~/.m2/settings.xml file as <servers><server>. Then upload your artifact by running:

mvn deploy