【问题标题】:IntelliJ cannot find maven-assembly-plugin im pom.xmlIntelliJ 找不到 maven-assembly-plugin im pom.xml
【发布时间】:2021-03-21 11:47:51
【问题描述】:

所以,我刚刚在我的新计算机上安装了 IntelliJ,并想在旧项目上工作,但现在 IntelliJ 找不到 maven-assembly-plugin。

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.1.1</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>main-class</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我尝试打开“使用插件注册表”-选项未成功并尝试多次重新导入,但程序集插件不会导入。我还检查了 .m2 文件夹,但它不包含程序集插件文件。此外,我很确定问题出在 IntelliJ 中的某个选项中,但我真的不知道这个选项在哪里,因为我对 IntelliJ 不是很熟悉。

【问题讨论】:

  • 我很确定问题出在你的 pom 上,而不是 IntelliJ 上。我已经使用了 16 年。您无需打开任何东西即可使用该插件。

标签: java intellij-idea maven-2 maven-plugin maven-assembly-plugin


【解决方案1】:

在 File -> Project Structure 上查看项目的版本,并尝试使用右侧的 Maven 选项卡并刷新他。

如果不起作用,请尝试 File -> Project Structure -> Modules 。删除项目并再次添加加号和次要按钮

【讨论】:

    【解决方案2】:

    我现在的解决方案是从 maven-assembly-plugin 切换到 maven-shade-plugin,这对我来说效果很好。但我不确定为什么其他插件不起作用。

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>main-class</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 1970-01-01
      • 2012-03-25
      • 1970-01-01
      • 2016-11-25
      • 2021-10-30
      • 1970-01-01
      • 2017-09-23
      • 2013-02-19
      相关资源
      最近更新 更多