Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Maven to build the project #87

Closed
nuest opened this issue Apr 30, 2014 · 12 comments
Closed

Use Maven to build the project #87

nuest opened this issue Apr 30, 2014 · 12 comments

Comments

@nuest
Copy link

nuest commented Apr 30, 2014

I'm new to the project, so maybe this was discussed before, so please overlook my ignorance in that case.

Would it be interesting for you to switch to Maven to build the Geoportal Server?

A colleague of mine has done the steps while he was working on a small extension. The general directory layout has to be changed, but most libraries can be loaded externally instead of having them in the lib directory (binaries in a source code management system are never nice).

You can see how the project looks like in his fork: https://github.com/hopmann/geoportal-server/tree/master/geoportal

Such refactoring must certainly be well organized between the developers, but if that is of interest I could try to help with this.

@mhogeweg
Copy link
Member

hi Daniel, we have no plans to switch to maven. just think about the cascading effects on code, documentation, forks, etc. just to switch to a different build system. however, it would be great if you could write up a page for the geoportal wiki documenting what you have done and referring users to your configuration.

@nuest
Copy link
Author

nuest commented May 2, 2014

Hi Marten! I totally understand that and would only see this as a long term idea. Seeing that this project as 65 forks I realize this kind of refactoring won't happen per my request only. However, it would have been considerably easier for me to get a development copy if Geoportal Server would use Maven. And just to collect some more arguments before I write that page you suggested:

I started to follow this tutorial (https://github.com/Esri/geoportal-server/wiki/Eclipse-Project-from-Source-Code), but to me this was simply not feasible: If I have to manually copy files into different folders I loose the connection with git. I was able to come up with a workflow for Eclipse that uses the same directory layout, which could be a useful wiki page as well.

How would you like to take a look at these pages? As a gist, maybe?

Concerning "my configuration" - I will discontinue this and manually transfer the edits my colleague made back to the current project layout, because I cannot get updates from upstream into the refarctored project easily. The fork will probably stay as it is to document the eventual layout of the project.

@ramunask
Copy link

ramunask commented May 4, 2014

I also vote for mavenizing geoportal project. We already did it for our project. It required us to guess artifacts used, split src folder to src/main/resources and src/main/java and etc. Unit tests were not working out-of-the box but we didn't tried to fix. I also noticed, that for catalog service test it uses different endpoint (not the one it builds).

After structure change it was hard to provide push requests or merge updates from trunk.

@nuest
Copy link
Author

nuest commented Jul 1, 2015

@ramunask we also did this for our fork, but also had to realize that it does not make sense to maintain a fork with a different build system.

@christinhenzen
Copy link

I would also argue that optimizing the build process helps to avoid copying source files and folders for updating local or online changes. Maybe it is possible to provide several project versions (the already published one and a maven-optimized one)?

@mhogeweg
Copy link
Member

mhogeweg commented Jul 1, 2015

We have done some internal work to understand the impact of moving to maven. I'll mark this issue an enhancement request and assign it to one of our developers.

@christinhenzen
Copy link

Sounds great. Thanks Marten.

@nuest
Copy link
Author

nuest commented Jul 3, 2015

@ramunask Is your mavenized version available on GitHub? Would be interesting to see how different our two approaches split things into modules etc. actually are.

@mhogeweg Would you still like me to write up a page for the GitHub wiki? I am sorry that I didn't follow up last year!

@ramunask
Copy link

ramunask commented Jul 3, 2015

@nuest no, it isn't in github. We mavenized 1.2.4 version of geoportal.
All java classes were moved to src/main/java, XML and other resources were moved to src/main/resources. Everything related to tests were moved to src/test/java and src/test/resources.
Web app resources were moved to src/main/webapp.
This is our version of pom.xml (removed our additional dependencies, some jar's needs to be installed locally):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>lt.hb.geoportal</groupId>
    <artifactId>geoportal</artifactId>
    <version>1.2.4</version>
    <packaging>war</packaging>
    <name>ESRI Metadata Catalog</name>
    <description>Mavenized Metadata Catalog based on ESRI geoportal 1.2.4 version</description>
    <properties>
        <!-- inherits all from parent -->
        <configfile>non-existing-file</configfile>
        <!-- Defines the source encoding -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- Defines source and target versions of java -->
        <java-version>1.6</java-version>
        <maven-bundle-plugin.version>2.3.4</maven-bundle-plugin.version>
        <maven-jar-plugin.version>2.4</maven-jar-plugin.version>
        <maven-war-plugin.version>2.3</maven-war-plugin.version>
    </properties>
    <repositories>
        <repository>
            <id>java.net.m2</id>
            <name>java.net m2 repo</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>project-local-repository</id>
            <name>Local repository</name>
            <layout>default</layout>
            <url>file://${basedir}/libs/repository</url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

        <!-- geoportal dependencies -->
        <dependency>
            <groupId>com.esri.arcgis</groupId>
            <artifactId>arcgis-agsws-stubs</artifactId>
            <version>10.2.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>el-api</artifactId>
            <version>2.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.myfaces.tomahawk</groupId>
            <artifactId>tomahawk</artifactId>
            <version>1.1.14</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.0</version>
        </dependency>



        <dependency>
            <groupId>com.esri.arcgis</groupId>
            <artifactId>arcgis-ws-runtime</artifactId>
            <version>10.2.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-codec</artifactId>
            <version>1.7</version>
            <exclusions>
                <exclusion>
                    <artifactId>batik-bridge</artifactId>
                    <groupId>org.apache.xmlgraphics</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>batik-transcoder</artifactId>
                    <groupId>org.apache.xmlgraphics</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>batik-awt-util</artifactId>
                    <groupId>org.apache.xmlgraphics</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>

        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.4</version>
        </dependency>

        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>

        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.0.1</version>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.7</version>
        </dependency>

        <dependency>
            <groupId>org.expressme</groupId>
            <artifactId>JOpenId</artifactId>
            <version>1.08</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.7</version>
        </dependency>

        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.7</version>
        </dependency>
<!--
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.0.3</version>
        </dependency>
-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>3.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-grouping</artifactId>
            <version>3.6.2</version>
        </dependency>


        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.soap</groupId>
            <artifactId>saaj-api</artifactId>
            <version>1.3</version>
        </dependency>

        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.0.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-tiles</artifactId>
            <version>1.3.10</version>
            <exclusions>
                <exclusion>
                    <groupId>antlr</groupId>
                    <artifactId>antlr</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.twitter4j</groupId>
            <artifactId>twitter4j-core</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>

        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.3</version>
        </dependency>

        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon-dom</artifactId>
            <version>8.7</version>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.10.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
        </dependency>

        <!-- for SOAP services -->     
<!--        <dependency> -->
<!--            <groupId>org.apache.axis2</groupId> -->
<!--            <artifactId>axis2-jaxws</artifactId> -->
<!--            <version>1.6.2</version> -->
<!--        </dependency> -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.2.8</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.stream.buffer</groupId>
            <artifactId>streambuffer</artifactId>
            <version>1.5.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>policy</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.gmbal</groupId>
            <artifactId>gmbal-api-only</artifactId>
            <version>3.2.0-b003</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.ha</groupId>
            <artifactId>ha-api</artifactId>
            <version>3.1.9</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>geoportal</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>gpt/config/gpt.xml</exclude>
                    <exclude>gpt/metadata/iso/inspire/inspire-iso-19115-definition.xml</exclude>
                    <exclude>gpt/metadata/iso/inspire/inspire-iso-19119-definition.xml</exclude>
                    <exclude>gpt/metadata/iso/nmdp/nmdp-iso-19115-definition.xml</exclude>
                    <exclude>gpt/metadata/iso/nmdp/nmdp-iso-19119-definition.xml</exclude>
                    <exclude>gpt/metadata/iso/iso-details.xslt</exclude>
                    <exclude>log4j.xml</exclude>
                    <exclude>logging.properties</exclude>
                    <exclude>conf/um_client_config.properties</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>gpt/config/gpt.xml</include>
                    <include>gpt/metadata/iso/inspire/inspire-iso-19115-definition.xml</include>
                    <include>gpt/metadata/iso/inspire/inspire-iso-19119-definition.xml</include>
                    <include>gpt/metadata/iso/nmdp/nmdp-iso-19115-definition.xml</include>
                    <include>gpt/metadata/iso/nmdp/nmdp-iso-19119-definition.xml</include>
                    <include>gpt/metadata/iso/iso-details.xslt</include>
                    <include>log4j.xml</include>
                    <include>logging.properties</include>
                    <include>conf/um_client_config.properties</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>gpt/config/gpt_dev.xml</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <!-- *********************************** -->
            <!-- prepares config file -->
            <!-- *********************************** -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <executions>
                    <!-- always read all configuration from config.properties -->
                    <execution>
                        <id>read-common-project-properties</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>src/main/resources/application.properties</file>
                                <file>src/main/config/application-${env.COMPUTERNAME}.properties</file>
                                <file>src/main/config/application-${environment}.properties</file>
                                <file>${configfile}</file>
                            </files>
                            <!-- do not throw exceptions if configfile is not passed -->
                            <quiet>true</quiet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- filter resources in webapp directory -->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>${basedir}/src/main/webapp</directory>
                            <filtering>false</filtering>
                            <excludes>
                                <exclude>META-INF/context.xml</exclude>
                                <exclude>WEB-INF/classes/gpt/config/gpt_dev.xml</exclude>
                            </excludes>
                        </resource>
                        <resource>
                            <directory>${basedir}/src/main/webapp</directory>
                            <filtering>true</filtering>
                            <includes>
                                <include>META-INF/context.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <excludes>
                        <exclude>com/esri/gpt/server/csw/provider/local/ProviderFactoryTest.java</exclude>
                        <exclude>com/esri/gpt/control/webharvest/client/arcims/ArcImsQueryBuilderTest.java</exclude>
                        <exclude>com/esri/gpt/control/webharvest/client/oai/OaiQueryBuilderTest.java</exclude>
                        <exclude>lt/hb/leip/metadata/catalog/migration/MetadataMigrationTest.java</exclude>
                        <exclude>lt/hb/leip/metadata/framework/mail/MailSendTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- tranform Schematron metadata validation rules to xslt files later used by metadata validator -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <catalogs>
                        <catalog>src/main/xml/catalog.xml</catalog>
                    </catalogs>
                    <transformationSets>
                        <transformationSet>
                            <dir>src/main/resources/gpt/metadata/validation</dir>
                            <includes>
                                <include>inspire_schematron_rules.saxon.xml</include>
                                <include>nmdp_schematron_rules.saxon.xml</include>
                            </includes>
                            <stylesheet>src/main/resources/gpt/metadata/validation/iso_svrl_for_xslt2_gpt.saxon.xsl</stylesheet>
                            <outputDir>${project.build.outputDirectory}/gpt/metadata/validation/</outputDir>
                            <fileMappers>
                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
                                    <pattern>\.xml$</pattern>
                                    <replacement>.xslt</replacement>
                                </fileMapper>
                            </fileMappers>
                        </transformationSet>
                    </transformationSets>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.saxon</groupId>
                        <artifactId>saxon</artifactId>
                        <version>8.7</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!--The configuration of this plugin is used to store the Eclipse M2E settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>properties-maven-plugin</artifactId>
                                        <versionRange> [0,)</versionRange>
                                        <goals>
                                            <!-- plugin goals -->
                                            <goal>read-project-properties</goal>
                                            <goal>write-project-properties</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <!-- M2E should ignore the plugin -->
                                        <!-- <ignore /> -->
                                        <execute>
                                            <runOnIncremental>true</runOnIncremental>
                                        </execute>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>xml-maven-plugin</artifactId>
                                        <versionRange>[1.0,)</versionRange>
                                        <goals>
                                            <goal>transform</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>sql-maven-plugin</artifactId>
                                        <versionRange>[1.5,)</versionRange>
                                        <goals>
                                            <goal>execute</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

@mhogeweg
Copy link
Member

mhogeweg commented Jul 3, 2015

@nuest yes, a wiki page would be great!

in general, we are not just looking at maven, but also to more recent tecnologies, such as Gradle.

@pandzel-zz
Copy link

Maven project files are in 'develop' branch, ready for 1.2.7 release.

@nuest
Copy link
Author

nuest commented Apr 6, 2016

@bpross-52n fyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants