【问题标题】:How to fix maven-shade-plugin error: Access denied如何修复 maven-shade-plugin 错误:访问被拒绝
【发布时间】:2022-07-19 15:45:25
【问题描述】:

我想在 JetBrains IntelliJ 中编译一个 Minecraft Spigot 插件。整个过程是在 Maven 的帮助下完成的。但这还没有真正起作用。每次我想编译它都会出现这个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project Kizume-RPG: Error creating shaded jar: C:\Users\denis\Desktop\Plugins (Zugriff verweigert) -> [Help 1]

这是我的 pom.xml

<?xml version="1.0" encoding="UTF-8"?>

4.0.0

<groupId>de.lenjee</groupId>
<artifactId>Kizume-RPG</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>Kizume RPG</name>

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

<build>
    <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.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                        <outputFile>C:\Users\denis\Desktop\Plugins</outputFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<repositories>
    <repository>
        <id>spigotmc-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
    <repository>
        <id>sonatype</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.18.1-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

也许有人知道错误。我已经用谷歌搜索过了,但解决方案对我不起作用。

【问题讨论】:

  • 配置的输出目录是不允许写的C:\Users\denis\Desktop\Plugins (Zugriff verweigert)这就是这个意思。您不应该更改这些输出目录。只需删除该配置并再次构建您的项目...
  • 这对我有用,谢谢。但是有没有其他的方法,给 IntelliJ 写这个目录的权限呢?
  • 权限由你的操作系统处理...

标签: maven intellij-idea


【解决方案1】:
<outputFile>C:\Users\denis\Desktop\Plugins</outputFile>

我发现您必须指定 java 文件才能使其工作,这对我有用。 您只放置文件夹,这似乎是问题所在。我的意思是放置文件:

<outputFile>C:\Users\denis\Desktop\Plugins\Plugin.java</outputFile>

代替“Plugin.java”,您可以只输入您想要的文件名称。 我知道这已经晚了,但它适用于像我这样努力寻找更简单解决方案的人。 希望这可以帮助任何仍然遇到此问题的人!

【讨论】:

    猜你喜欢
    • 2013-07-10
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多