Obtain the "non free" modules via a pre-built jar by default.

This way testing changes to the core checks will be easier:
* By default NCPCompatNonFree is fetched from the repository (prevent
via -Dno_nonfree).
* To build "non free" modules, -P nonfree_build is needed. In addition
you need to specify the profiles for what to build, such as -P all an
the like.
This commit is contained in:
asofold 2018-01-10 01:54:08 +01:00
parent 8d1d7ab410
commit e5c8bec62b
5 changed files with 161 additions and 22 deletions

View File

@ -20,6 +20,7 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
<version>1.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
@ -48,6 +49,7 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
<module>NCPCompatSpigotCB1_9_R2</module>
<module>NCPCompatSpigotCB1_10_R1</module>
<module>NCPCompatSpigotCB1_11_R1</module>
<!-- ... -->
<module>NCPCompatCBDev</module>
</modules>
@ -57,6 +59,7 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
@ -174,6 +177,8 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
</dependencies>
</profile>
<!-- ... -->
<profile>
<id>spigot1_12_r1</id>
<modules>
@ -274,7 +279,6 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
</profiles>
<build>
<plugins>
<plugin>
@ -287,5 +291,4 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
</plugins>
</build>
<packaging>pom</packaging>
</project>

View File

@ -0,0 +1,86 @@
<?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>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfreejar</artifactId>
<version>1.2-SNAPSHOT</version>
<name>NCPCompatNonFreeJar</name>
<description>Create a jar from NCPCompatNonFree.</description>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
</dependencies>
<!-- Profile based activation of jar file build -->
<profiles>
<profile>
<id>nonfree_build</id>
<distributionManagement>
<repository>
<id>md_5-releases</id>
<url>https://repo.md-5.net/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>md_5-snapshots</id>
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- Building -->
<build>
<defaultGoal>clean package</defaultGoal>
<directory>../../target</directory> <!-- Build it two levels up, because it is the one we care about -->
<finalName>NCPCompatNonFree</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>fr.neatmonster:*</include>
</includes>
<!-- Clearly not sure about excludes... -->
<!-- <excludes> <exclude>fr.neatmonster:nocheatplus-parent</exclude>
</excludes> -->
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- <skip>true</skip> -->
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -48,15 +48,51 @@ For the plugin/artifact version see the NoCheatPlus module.</description>
<artifactId>ncpcompatprotocollib</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- "Non free" might later be an extra profile. -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
</dependencies>
<!-- Profiles for enabling/disabling features. -->
<profiles>
<profile>
<id>nonfree_build</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>compile</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfreejar</artifactId>
<version>1.2-SNAPSHOT</version>
<!-- <scope>compile</scope> -->
<type>jar</type>
</dependency>
</dependencies>
</profile>
<profile>
<id>nonfree_include</id>
<activation>
<property>
<name>!no_nonfree</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfreejar</artifactId>
<version>1.2-SNAPSHOT</version>
<!-- <scope>compile</scope> -->
<type>jar</type>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>

View File

@ -20,7 +20,7 @@ Compiling NoCheatPlus
---------
* NoCheatPlus used to be compiled with java 6 compliance (note OpenJDK, possibly we'll switch to 8 directly, once appropriate, e.g. with ProtocolLib dropping support for 7.).
* We use [Maven](http://maven.apache.org/download.cgi) 3 to handle the dependencies.
* You can compile with this Maven goal: `mvn clean package`, if you don't want any dedicated CraftBukkit modules, or if you are lacking the jar files - **for best performance and compatibility, choose the appropriate build profile(s) from below**. If you do have all the legacy dependencies, you can activate the profile `all` adding `-P all` to the maven goals. For more options, see the table below. If your specific needs are not met by the provided options, you can still build only using the compat module(s) that you need, e.g. by adjusting the build/dependency profiles or adding your own profile, which means changing/adding a profile both in the root pom.xml for modules to have and in NCPPlugin/pom.xml for the dependency inclusion. The preset profiles should be enough of a hint for that. If you add custom modules with a different package naming than `fr.neatmonster`, you might have to add the source inclusion to the NoCheatPlus/pom.xml as well.
* You can compile with this Maven goal: `mvn clean package`, for a standard build. To also (re-) build "non free" compatibility modules that depend on Spigot or the like, Maven profiles can be chosen. For reference on profiles see the table below. See the NCPCompatNonFree sub module for reference on how to add custom modules. If you add custom modules with a different package naming than `fr.neatmonster`, you might have to add the source inclusion to the NoCheatPlus/pom.xml as well.
* Jar files for the dedicated compat modules, which your local maven repository might be missing, can be installed manually.
Example for Eclipse with embedded maven:
Add a new maven build run configuration, name it appropriately, e.g. ```Install CB 1.7.5```.
@ -28,23 +28,28 @@ Set goals to: ```install:install-file -Dfile=<PATH TO JAR> -DgroupId=org.bukkit
On Windows the <PATH TO JAR> might look like: ```X:\...\craftbukkit\3042\craftbukkit-1.7.5-R0.1-20140408.020329-16.jar```
To let it run you might have to set the base directory, e.g. to ```${workspace_loc}```, it does not seem to have significance.
Do set the correct version alongside the file name. On newer version of maven, you might do with much simplified goals, because the pom files inside the jars are parsed.
* **The latest versions of BuildTools.jar will automatically install the necessary server jars into the local .m2 repository (e.g. on linux) - provided configuration paths are standard. Thus you don't need to do this manually anymore, if you then build NCP with the specific profile, if you have run BuildTools.jar to generate the server jars on that machine/environment.**
* **The latest versions of BuildTools.jar will automatically install the created server jars into the local .m2 repository (e.g. on linux) - provided configuration paths are standard. Thus you don't need to do this manually anymore, if you then build NCP with the specific profile, if you have run BuildTools.jar to generate the server jars on that machine/environment.**
All profiles for reference:
Options and profiles related to enabling/disabling including/building "non free" compatibility modules.
**Maven profiles remain for selection of compatibility modules, activation parameters have been removed, ncp_base has been removed.**
| Profile | Parameter | Description |
| :------------------ | :-------------- | :-------------- |
| _none_ | _none_ | The "non free" modules are included via a pre-built jar file from the repository. |
| -P nonfree_build | _none_ | Enable building "non free" compatibility modules. The NCPCompatNonFree jar file is built/installed/(deployed). |
| _none_ | -Dno_nonfree | The "non free" modules are neither built, nor included via a pre-built jar file. |
Profiles for choice of "non free" compatibility modules to build:
| Profile | Description |
| :------------------ | :-------------- |
| _none_ | Default build without any of the native access modules, might pose compatibility issues with latest Minecraft versions. The reflection based module is included here. |
| `-P all` | All compatibility modules. |
| `-P spigot1_7_r4` | Just Spigot 1.7 R4 (MC 1.7.10). |
| `-P spigot1_8_r3` | Just Spigot 1.8 R3 (MC 1.8.4-1.8.8). |
| `-P spigot1_9_r1` | Just Spigot 1.9 R1 (MC 1.9-1.9.3). |
| `-P spigot1_9_r2` | Just Spigot 1.9 R2 (MC 1.9.4). |
| `-P spigot1_10_r1` | Just Spigot 1.10 R1 (MC 1.10-1.10.2). |
| `-P spigot1_11_r1` | Just Spigot 1.11 R1 (MC 1.11-1.11.2). |
| `-P spigot1_12_r1` | Just Spigot 1.12 R1 (MC 1.12-1.12.2). |
| `-P spigot1_7_r4` | Spigot 1.7 R4 (MC 1.7.10). |
| `-P spigot1_8_r3` | Spigot 1.8 R3 (MC 1.8.4-1.8.8). |
| `-P spigot1_9_r2` | Spigot 1.9 R2 (MC 1.9.4). |
| `-P spigot1_10_r1` | Spigot 1.10 R1 (MC 1.10-1.10.2). |
| `-P spigot1_11_r1` | Spigot 1.11 R1 (MC 1.11-1.11.2). |
| `-P spigot1_12_r1` | Spigot 1.12 R1 (MC 1.12-1.12.2). |
| `-P cbdev` | The latest version in development. |
(On the long run, only the latest module for a major Minecraft release may be be kept, such as 1_8_r3 for all of 1.8.x.)

13
pom.xml
View File

@ -24,10 +24,19 @@
<module>NCPCompatProtocolLib</module>
<module>NCPPlugin</module>
<module>NoCheatPlus</module>
<!-- "Non free" might later be an extra profile. -->
<module>NCPCompatNonFree</module>
</modules>
<!-- Profiles for enabling/disabling features. -->
<profiles>
<profile>
<id>nonfree_build</id>
<modules>
<module>NCPCompatNonFree</module>
<module>NCPCompatNonFreeJar</module>
</modules>
</profile>
</profiles>
<repositories>
<repository>
<id>spigot-repo</id>