Ticket #8269: 8269.patch

File 8269.patch, 15.6 KB (added by taylor.smock, 2 years ago)

Maven changes for JMapViewer

  • tools/checkstyle/jmapviewer_checks.xml

    Subject: [PATCH] See #8269: Add support for maven as an alternative to Eclipse and ant
    
    See CONTRIBUTING.md for a mapping of `ant` tasks to `maven` tasks/goals.
    Of note, each mapping is as close to a 1-1 match as possible. In the event that
    we move off of `ant`, the `pom.xml` file can be simplified, especially if the
    directory layout is changed to the maven defaults.
    ---
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/tools/checkstyle/jmapviewer_checks.xml b/tools/checkstyle/jmapviewer_checks.xml
    a b  
    112112    <property name="lineSeparator" value="lf"/>
    113113  </module>
    114114  <module name="SuppressionFilter">
    115     <property name="file" value="${basedir}/tools/checkstyle/jmapviewer_filters.xml"/>
     115    <property name="file" value="tools/checkstyle/jmapviewer_filters.xml"/>
    116116    <property name="optional" value="true"/>
    117117  </module>
    118118  <module name="SuppressWithPlainTextCommentFilter">
  • build.xml

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/build.xml b/build.xml
    a b  
    139139    <target name="checkstyle" depends="resolve">
    140140        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
    141141            classpathref="checkstyle.classpath"/>
    142         <checkstyle config="tools/checkstyle/jmapviewer_checks.xml">
     142        <checkstyle config="${basedir}/tools/checkstyle/jmapviewer_checks.xml">
    143143            <!-- Exclude the module-info since checkstyle currently cannot parse it -->
    144144            <fileset dir="${basedir}/src" includes="**/*.java" excludes="module-info.java" />
    145145            <formatter type="xml" toFile="checkstyle-jmapviewer.xml"/>
  • new file CONTRIBUTING.md

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
    new file mode 100644
    - +  
     1# Contributing
     2## How to test
     3* Unit tests: `mvn test`
     4* Manual testing: `mvn compile exec:java -Dexec.mainClass=org.openstreetmap.gui.jmapviewer.Demo`
     5
     6## How to report a bug
     7Please open a ticket at [https://josm.openstreetmap.de/newticket?component=JMapViewer](https://josm.openstreetmap.de/newticket?component=JMapViewer).
     8
     9## How to submit changes
     10Open a ticket at [https://josm.openstreetmap.de/newticket?component=JMapViewer](https://josm.openstreetmap.de/newticket?component=JMapViewer).
     11See [https://josm.openstreetmap.de/wiki/DevelopersGuide/PatchGuide](https://josm.openstreetmap.de/wiki/DevelopersGuide/PatchGuide) for how to create the patch file and submit it.
     12
     13## Check patch conformance
     14* `mvn validate`
     15  * `mvn checkstyle:checkstyle`
     16* `mvn spotbugs:check` -- this should be done by `mvn validate` as well, but it
     17  wasn't possible at time of writing due to existing spotbugs bugs in JMapViewer.
     18
     19## Ant targets -> Maven targets
     20* `ant clean` -> `mvn clean`
     21* `ant build` -> `mvn compile`
     22* `ant test` -> `mvn test`
     23* `ant svn_info` -> manual pom.xml editing for now
     24* `ant pack` -> `mvn package` (note: slightly different source filename)
     25* `ant create_run_jar` -> not migrated (use `mvn exec:java -Dexec.mainClass="org.openstreetmap.gui.jmapviewer.Demo"` instead)
     26* `ant spotbugs` -> `mvn spotbugs:check`
     27* `ant checkstyle` -> `mvn checkstyle:checkstyle`
     28* `ant javadoc` -> `mvn javadoc:javadoc`
     29* `ant create_release_zip` -> `mvn jar:jar`
     30* `ant create_source_release_zip` -> `mvn source:jar`
     31* `ant checkdepsupdate` -> `mvn versions:display-dependency-updates`
  • new file pom.xml

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/pom.xml b/pom.xml
    new file mode 100644
    - +  
     1<?xml version="1.0" encoding="UTF-8"?>
     2
     3<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
     4         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     5    <modelVersion>4.0.0</modelVersion>
     6
     7    <groupId>org.openstreetmap.jmapviewer</groupId>
     8    <artifactId>jmapviewer</artifactId>
     9    <version>2.19-SNAPSHOT</version>
     10
     11    <name>JMapViewer</name>
     12    <url>https://josm.openstreetmap.de/browser/osm/applications/viewer/jmapviewer</url>
     13    <properties>
     14        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     15        <maven.compiler.release>8</maven.compiler.release>
     16        <version.maven.spotbugs>4.8.1.0</version.maven.spotbugs>
     17        <version.maven.jacoco>0.8.11</version.maven.jacoco>
     18    </properties>
     19    <licenses>
     20        <license><!-- Might be GPL-2.0-or-later, but no instances of "or later" in source code -->
     21            <name>GPL-2.0-only</name>
     22            <url>https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html</url>
     23            <distribution>repo</distribution>
     24        </license>
     25    </licenses>
     26    <organization>
     27        <name>JOSM</name>
     28        <url>https://josm.openstreetmap.de</url>
     29    </organization>
     30    <contributors>
     31        <contributor><name>Tim Haussmann</name></contributor>
     32        <contributor><name>Jan Peter Stotz</name></contributor>
     33        <contributor><name>Dirk Stöcker</name></contributor>
     34        <contributor><name>Stefan Zeller</name></contributor>
     35        <contributor><name>Karl Guggisberg</name></contributor>
     36        <contributor><name>Dave Hansen</name></contributor>
     37        <contributor><name>Ian Dees</name></contributor>
     38        <contributor><name>Michael Vigovsky</name></contributor>
     39        <contributor><name>Paul Hartmann</name></contributor>
     40        <contributor><name>Gleb Smirnoff</name></contributor>
     41        <contributor><name>Vincent Privat</name></contributor>
     42        <contributor><name>Jason Huntley</name></contributor>
     43        <contributor><name>Simon Legner</name></contributor>
     44        <contributor><name>Teemu Koskinen</name></contributor>
     45        <contributor><name>Jiri Klement</name></contributor>
     46        <contributor><name>Matt Hoover</name></contributor>
     47        <contributor><name>Alexei Kasatkin</name></contributor>
     48        <contributor><name>Galo Higueras</name></contributor>
     49        <contributor><name>Wiktor Niesiobędzki</name></contributor>
     50        <contributor><name>Robert Scott</name></contributor>
     51    </contributors>
     52    <scm>
     53        <connection>scm:svn:https://josm.openstreetmap.de/osmsvn/applications/viewer/jmapviewer/</connection>
     54        <url>https://josm.openstreetmap.de/browser/osm/applications/viewer/jmapviewer/</url>
     55    </scm>
     56    <issueManagement>
     57        <system>Trac</system>
     58        <url>https://josm.openstreetmap.de</url>
     59    </issueManagement>
     60    <mailingLists>
     61        <mailingList>
     62            <name>josm-dev</name>
     63            <archive>https://lists.openstreetmap.org/pipermail/josm-dev/</archive>
     64            <post>josm-dev@openstreetmap.org</post>
     65        </mailingList>
     66    </mailingLists>
     67    <distributionManagement>
     68        <repository>
     69            <id>josm-nexus-releases</id>
     70            <name>JOSM Nexus (Releases)</name>
     71            <url>https://josm.openstreetmap.de/nexus/content/repositories/releases/</url>
     72        </repository>
     73        <snapshotRepository>
     74            <id>josm-nexus-snapshot</id>
     75            <name>JOSM Nexus (Snapshot)</name>
     76            <url>https://josm.openstreetmap.de/nexus/content/repositories/snapshots/</url>
     77        </snapshotRepository>
     78    </distributionManagement>
     79
     80    <dependencyManagement>
     81        <dependencies>
     82            <dependency>
     83                <groupId>org.junit</groupId>
     84                <artifactId>junit-bom</artifactId>
     85                <version>5.10.1</version>
     86                <type>pom</type>
     87                <scope>import</scope>
     88            </dependency>
     89        </dependencies>
     90    </dependencyManagement>
     91
     92    <dependencies>
     93        <dependency>
     94            <groupId>com.github.spotbugs</groupId>
     95            <artifactId>spotbugs-annotations</artifactId>
     96            <version>4.8.3</version>
     97            <scope>test</scope>
     98        </dependency>
     99        <dependency>
     100            <groupId>org.junit.platform</groupId>
     101            <artifactId>junit-platform-launcher</artifactId>
     102            <scope>test</scope>
     103        </dependency>
     104        <dependency>
     105            <groupId>org.junit.platform</groupId>
     106            <artifactId>junit-platform-suite</artifactId>
     107            <scope>test</scope>
     108        </dependency>
     109        <dependency>
     110            <groupId>org.junit.jupiter</groupId>
     111            <artifactId>junit-jupiter-api</artifactId>
     112            <scope>test</scope>
     113        </dependency>
     114        <dependency>
     115            <groupId>org.junit.jupiter</groupId>
     116            <artifactId>junit-jupiter-engine</artifactId>
     117            <scope>test</scope>
     118        </dependency>
     119        <dependency>
     120            <groupId>org.junit.jupiter</groupId>
     121            <artifactId>junit-jupiter-params</artifactId>
     122            <scope>test</scope>
     123        </dependency>
     124    </dependencies>
     125
     126    <build>
     127        <sourceDirectory>${project.basedir}/src</sourceDirectory>
     128        <testSourceDirectory>${project.basedir}/test</testSourceDirectory>
     129        <finalName>${project.name}-${project.version}</finalName>
     130        <resources>
     131            <resource>
     132                <directory>${project.build.sourceDirectory}</directory>
     133                <includes>
     134                    <include>
     135                        **/*.png
     136                    </include>
     137                </includes>
     138            </resource>
     139        </resources>
     140        <plugins>
     141            <plugin>
     142                <groupId>org.apache.maven.plugins</groupId>
     143                <artifactId>maven-jar-plugin</artifactId>
     144                <version>3.3.0</version>
     145                <configuration>
     146                    <outputDirectory>releases/${project.version}</outputDirectory>
     147                </configuration>
     148            </plugin>
     149            <plugin>
     150                <groupId>org.apache.maven.plugins</groupId>
     151                <artifactId>maven-source-plugin</artifactId>
     152                <version>3.3.0</version>
     153                <configuration>
     154                    <outputDirectory>releases/${project.version}</outputDirectory>
     155                </configuration>
     156                <executions>
     157                    <execution>
     158                        <id>attach-sources</id>
     159                        <phase>package</phase>
     160                        <goals>
     161                            <goal>jar-no-fork</goal>
     162                        </goals>
     163                    </execution>
     164                </executions>
     165            </plugin>
     166            <plugin>
     167                <groupId>org.apache.maven.plugins</groupId>
     168                <artifactId>maven-compiler-plugin</artifactId>
     169                <version>3.11.0</version>
     170                <executions>
     171                    <execution>
     172                        <id>default-compile</id>
     173                        <configuration>
     174                            <release>11</release>
     175                        </configuration>
     176                    </execution>
     177                    <execution>
     178                        <id>base-compile</id>
     179                        <goals>
     180                            <goal>compile</goal>
     181                        </goals>
     182                        <configuration>
     183                            <release>8</release>
     184                            <excludes>
     185                                <exclude>module-info.java</exclude>
     186                            </excludes>
     187                        </configuration>
     188                    </execution>
     189                </executions>
     190            </plugin>
     191            <!-- Start optional plugins (these can be removed by Linux distributions for building) -->
     192            <plugin>
     193                <groupId>org.jacoco</groupId>
     194                <artifactId>jacoco-maven-plugin</artifactId>
     195                <version>${version.maven.jacoco}</version>
     196                <executions>
     197                    <execution>
     198                        <id>default-prepare-agent</id>
     199                        <goals>
     200                            <goal>prepare-agent</goal>
     201                        </goals>
     202                    </execution>
     203                    <execution>
     204                        <id>default-report</id>
     205                        <goals>
     206                            <goal>report</goal>
     207                        </goals>
     208                    </execution>
     209                </executions>
     210            </plugin>
     211            <plugin>
     212                <groupId>com.github.spotbugs</groupId>
     213                <artifactId>spotbugs-maven-plugin</artifactId>
     214                <version>${version.maven.spotbugs}</version>
     215                <configuration>
     216                    <xmlOutput>true</xmlOutput>
     217                    <spotbugsXmlOutputFilename>spotbugs-jmapviewer.xml</spotbugsXmlOutputFilename>
     218                    <effort>max</effort>
     219                </configuration>
     220                <!-- This is commented out until all the current bugs are fixed. TODO uncomment!
     221                <executions>
     222                    <execution>
     223                        <id>validate</id>
     224                        <phase>validate</phase>
     225                        <goals>
     226                            <goal>check</goal>
     227                        </goals>
     228                    </execution>
     229                </executions>
     230                -->
     231            </plugin>
     232            <plugin>
     233                <groupId>org.apache.maven.plugins</groupId>
     234                <artifactId>maven-checkstyle-plugin</artifactId>
     235                <version>3.3.1</version>
     236                <configuration>
     237                    <configLocation>${project.basedir}/tools/checkstyle/jmapviewer_checks.xml</configLocation>
     238                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
     239                    <outputFile>${project.basedir}/checkstyle-jmapviewer.xml</outputFile>
     240                    <!-- checkstyle cannot parse module-info.java yet -->
     241                    <excludes>module-info.java</excludes>
     242                </configuration>
     243                <executions>
     244                    <execution>
     245                        <id>validate</id>
     246                        <phase>validate</phase>
     247                        <goals>
     248                            <goal>check</goal>
     249                        </goals>
     250                    </execution>
     251                </executions>
     252            </plugin>
     253        </plugins>
     254    </build>
     255
     256    <reporting>
     257        <plugins>
     258            <plugin>
     259                <groupId>org.apache.maven.plugins</groupId>
     260                <artifactId>maven-surefire-report-plugin</artifactId>
     261                <version>3.2.3</version>
     262            </plugin>
     263            <plugin>
     264                <groupId>org.jacoco</groupId>
     265                <artifactId>jacoco-maven-plugin</artifactId>
     266                <version>${version.maven.jacoco}</version>
     267                <reportSets>
     268                    <reportSet>
     269                        <reports>
     270                            <report>report</report>
     271                        </reports>
     272                    </reportSet>
     273                </reportSets>
     274            </plugin>
     275        </plugins>
     276    </reporting>
     277</project>