-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4cbb7a4
Showing
42 changed files
with
2,579 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?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>me.mrfunny</groupId> | ||
<artifactId>spigot-packager</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<description>Simple plugin that helps to copy spigot plugin to your server plugins folder when you package project</description> | ||
<name>spigot-packager Package Plugin</name> | ||
<packaging>maven-plugin</packaging> | ||
|
||
<url>http://maven.apache.org</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<organization> | ||
<name>MrFunny (Koper Studio)</name> | ||
<url>https://koper.pw/</url> | ||
</organization> | ||
|
||
<scm> | ||
<url>https://svn.apache.org/viewvc/maven</url> | ||
</scm> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<reportSets> | ||
<reportSet> | ||
<reports> | ||
<report>report</report> | ||
</reports> | ||
</reportSet> | ||
</reportSets> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-plugin-plugin</artifactId> | ||
<version>3.6.4</version> | ||
<executions> | ||
<execution> | ||
<id>default-descriptor</id> | ||
<phase>process-classes</phase> | ||
</execution> | ||
<!-- if you want to generate help goal --> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.8.2</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-plugin-api</artifactId> | ||
<version>3.6.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.plugin-tools</groupId> | ||
<artifactId>maven-plugin-annotations</artifactId> | ||
<version>3.6.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-project</artifactId> | ||
<version>2.2.1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package me.mrfunny; | ||
|
||
import org.apache.maven.plugin.AbstractMojo; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
import org.apache.maven.plugins.annotations.LifecyclePhase; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.project.MavenProject; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
|
||
@Mojo(name = "spigot-package", defaultPhase = LifecyclePhase.COMPILE) | ||
public class PackagePluginMojo extends AbstractMojo { | ||
|
||
@Parameter(defaultValue = "${project}", readonly = true, required = true) | ||
MavenProject project; | ||
|
||
@Parameter(property = "pluginsFolder", required = true) | ||
String pluginsFolder; | ||
|
||
@Override | ||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
System.out.println("Copying plugin to " + pluginsFolder); | ||
File outputFile = new File(project.getBuild().getDirectory(), project.getArtifactId() + "-"+ project.getVersion() + ".jar"); | ||
File pluginsFile = new File(this.pluginsFolder, project.getArtifactId() + "-"+ project.getVersion() + ".jar"); | ||
if (outputFile.exists()) { | ||
try { | ||
Files.copy(outputFile.toPath(), pluginsFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} else { | ||
throw new MojoFailureException("File not found: " + outputFile.getAbsolutePath()); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
target/classes/META-INF/maven/me.mrfunny/spigot-packager/plugin-help.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- Generated by maven-plugin-tools 3.6 --> | ||
|
||
<plugin> | ||
<name>spigot-packager Package Plugin</name> | ||
<description></description> | ||
<groupId>me.mrfunny</groupId> | ||
<artifactId>spigot-packager</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<goalPrefix>spigot-packager</goalPrefix> | ||
<mojos> | ||
<mojo> | ||
<goal>spigot-package</goal> | ||
<requiresDirectInvocation>false</requiresDirectInvocation> | ||
<requiresProject>true</requiresProject> | ||
<requiresReports>false</requiresReports> | ||
<aggregator>false</aggregator> | ||
<requiresOnline>false</requiresOnline> | ||
<inheritedByDefault>true</inheritedByDefault> | ||
<phase>compile</phase> | ||
<implementation>me.mrfunny.PackagePluginMojo</implementation> | ||
<language>java</language> | ||
<instantiationStrategy>per-lookup</instantiationStrategy> | ||
<executionStrategy>once-per-session</executionStrategy> | ||
<threadSafe>false</threadSafe> | ||
<parameters> | ||
<parameter> | ||
<name>pluginsFolder</name> | ||
<type>java.lang.String</type> | ||
<required>true</required> | ||
<editable>true</editable> | ||
<description></description> | ||
</parameter> | ||
</parameters> | ||
<configuration> | ||
<pluginsFolder implementation="java.lang.String">${pluginsFolder}</pluginsFolder> | ||
</configuration> | ||
</mojo> | ||
</mojos> | ||
</plugin> |
Oops, something went wrong.