java maven项目不会导入插件

6qqygrtg  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(739)

我在intellij社区版中有一个maven项目,我正在尝试将所有内容打包到一个jar文件中,以便执行。我一直在关注在线教程,并尝试向pom.xml文件添加几个插件。但是,它们都以红色显示,并显示以下错误消息:

  1. Plugin 'org.apache.maven.plugins:maven-shade-plugin:' not found
  2. Plugin 'maven-assembly-plugin:' not found
  3. Plugin 'org.apache.maven.plugins:maven-compiler-plugin:' not found

我尝试过使缓存失效并重新启动缓存。我在maven设置中启用了使用插件注册表选项。我还多次尝试重新加载maven项目,但都没有成功。有解决办法吗?或者我可以从项目中创建可执行jar的任何其他方式。
仅供参考,如果这很重要,我也在mac上。

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-shade-plugin</artifactId>
  6. <executions>
  7. <execution>
  8. <goals>
  9. <goal>shade</goal>
  10. </goals>
  11. <configuration>
  12. <shadedArtifactAttached>true</shadedArtifactAttached>
  13. <transformers>
  14. <transformer implementation=
  15. "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  16. <mainClass>Your_main_class_here</mainClass>
  17. </transformer>
  18. </transformers>
  19. </configuration>
  20. </execution>
  21. </executions>
  22. </plugin>
  23. <plugin>
  24. <artifactId>maven-assembly-plugin</artifactId>
  25. <configuration>
  26. <finalName>ServiceCreate</finalName>
  27. <appendAssemblyId>false</appendAssemblyId>
  28. <archive>
  29. <manifest>
  30. <mainClass>com.svt.optimoo.App</mainClass>
  31. </manifest>
  32. </archive>
  33. <descriptorRefs>
  34. <descriptorRef>jar-with-dependencies</descriptorRef>
  35. </descriptorRefs>
  36. </configuration>
  37. </plugin>
  38. <plugin>
  39. <groupId>org.apache.maven.plugins</groupId>
  40. <artifactId>maven-compiler-plugin</artifactId>
  41. <configuration>
  42. <source>1.8</source>
  43. <target>1.8</target>
  44. </configuration>
  45. </plugin>
  46. </plugins>
  47. </build>
  48. </project>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题