Войти или зарегистрироваться
  • Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.

Компилирование плагина из исходников

Статус
Закрыто для дальнейших ответов.

ak2913375

Активный участник
Пользователь
Баллы
66
Имя в Minecraft
aim07
Здравствуйте. Наткнулся на плагин, который в бесплатном доступе только в виде исходников и вот при попытке самому скомпилировать у меня получается пустой jar-файл. Компилировал в IntellijIdea. А с Eclipse так вообще +100 ошибок. Буду благодарен, если поможете разобраться в этом.
https://github.com/arkflame/ExploitFixer
 
Как именно компилировал? В идеале просто свой pom'ник сделать, и компилировать через maven.
 
Как именно компилировал? В идеале просто свой pom'ник сделать, и компилировать через maven.
Пробовал разными способами и так тоже, но в итоге либо ошибка, либо пустой jar. upload_2023-5-1_23-25-41.pngupload_2023-5-1_23-27-26.png
 
Собрал такой pom'ник, джарник собирает. Правда, не знаю, будет ли плагин работать. Не забудь HamsterAPI установить на сервер.
HTML:
<?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>dev._2lstudios</groupId>
    <artifactId>exploitfixer</artifactId>
    <version>2.2.5-SNAPSHOT</version>

    <name>ExploitFixer</name>

    <description>Protect your Minecraft server from exploits and crashers</description>

    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>com.github.steveice10</pattern>
                                    <shadedPattern>dev._2lstudios.exploitfixer.lib</shadedPattern>
                                </relocation>
                            </relocations>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/maven/**</exclude>
                                        <exclide>META-INF/MANIFEST.MF</exclide>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <minimizeJar>true</minimizeJar>
                </configuration>
            </plugin>
        </plugins>
        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>papermc</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>opencollab-releases</id>
            <url>https://repo.opencollab.dev/maven-releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.arkflame</groupId>
            <artifactId>HamsterAPI</artifactId>
            <version>0.2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.steveice10</groupId>
            <artifactId>opennbt</artifactId>
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
upd: Хотя, похоже, HamsterAPI автоматически и так устанавливается.
 
Собрал такой pom'ник, джарник собирает. Правда, не знаю, будет ли плагин работать. Не забудь HamsterAPI установить на сервер.
HTML:
<?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>dev._2lstudios</groupId>
    <artifactId>exploitfixer</artifactId>
    <version>2.2.5-SNAPSHOT</version>

    <name>ExploitFixer</name>

    <description>Protect your Minecraft server from exploits and crashers</description>

    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>com.github.steveice10</pattern>
                                    <shadedPattern>dev._2lstudios.exploitfixer.lib</shadedPattern>
                                </relocation>
                            </relocations>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/maven/**</exclude>
                                        <exclide>META-INF/MANIFEST.MF</exclide>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <minimizeJar>true</minimizeJar>
                </configuration>
            </plugin>
        </plugins>
        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>papermc</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>opencollab-releases</id>
            <url>https://repo.opencollab.dev/maven-releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.19.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.arkflame</groupId>
            <artifactId>HamsterAPI</artifactId>
            <version>0.2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.steveice10</groupId>
            <artifactId>opennbt</artifactId>
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
upd: Хотя, похоже, HamsterAPI автоматически и так устанавливается.
Спасибо. Это сработало)
 
Последнее редактирование:
Статус
Закрыто для дальнейших ответов.

Поделиться этой страницей

Назад
Верх