I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do 'Run As---> Maven install', I am getting the following error :
我使用的是Maven 3.0.5和Spring Tool Source 3.2,安装了Maven插件。当我尝试“运行为---> Maven安装”时,我得到了以下错误:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Social Twitter4J Sample 1.0.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.maven.plugins:maven-war-plugin:jar:2.1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ spring-social-twitter4j ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 15 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ spring-social-twitter4j ---
[WARNING] The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Jun 21, 2013 2:14:32 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: org.apache.maven.plugin.CompilerMojo
**java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/CompilerException**
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:98)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:831)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:758)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:255)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:204)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:954)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:987)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:950)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1000)
at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:965)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1011)
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.compiler.CompilerException
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 54 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.749s
[INFO] Finished at: Fri Jun 21 02:14:32 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
**[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project spring-social-twitter4j: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile: org/codehaus/plexus/compiler/CompilerException**
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-compiler-plugin:2.3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/SS%20Computer/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar
[ERROR] urls[1] = file:/C:/Users/SS%20Computer/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.codehaus.plexus.compiler.CompilerException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Please find below my pom.xml:
xml:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.social.samples</groupId>
<artifactId>spring-social-twitter4j</artifactId>
<name>Spring Social Twitter4J Sample</name>
<packaging>war</packaging>
<version>1.0.0</version>
<properties>
<java-version>1.6</java-version>
<org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
<org.springframework-version>3.2.1.RELEASE</org.springframework-version>
<org.springframework.security-version>3.1.3.RELEASE</org.springframework.security-version>
<org.slf4j-version>1.7.2</org.slf4j-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${org.springframework.security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.security-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-web</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<!-- Twitter4J -->
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>2.2.3</version>
</dependency>
<!-- JSR 303 with Hibernate Validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.159</version>
</dependency>
<!-- @Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- CGLIB, only required and used for @Configuration usage -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>org.springframework.maven.release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- For testing against latest Spring snapshots -->
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Spring Maven Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- For developing against latest Spring milestones -->
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warName>spring-social-twitter4j</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
</plugin>
</plugins>
</build>
</project>
During maven install my goal is war:war to make WAR of my application. Any timely help would be appreciated.
在maven安装过程中,我的目标是war:war来生成应用程序的war。如有任何及时的帮助,我们将不胜感激。
20 个解决方案
#1
106
Deleting full .m2/repository
local repository solved my problem.
删除完整的.m2/存储库本地存储库解决了我的问题。
Or else you need to know what plugins are you using exactly with their dependencies as one of the plugin suffered a problem while downloading.
或者你需要知道你用的是什么插件,因为其中一个插件在下载时遇到了问题。
#2
88
Deleting full .m2 local repository solved my problem, too.
删除完整的.m2本地存储库也解决了我的问题。
If you don't know where it is, the locations are:
如果你不知道它在哪里,地点是:
Unix/Mac OS X – ~/.m2/repository
Windows – C:\Documents and Settings\{your-username}\.m2\repository
#3
30
I am adding more points to the solution by @Rushi Shah
@Rushi Shah向解决方案添加了更多的点
mvn clean install -X
helps to identify the root cause.
mvn清洁安装-X有助于识别根本原因。
Some of the important phases of Maven build lifecycle are:
Maven构建生命周期的一些重要阶段是:
clean
– the project is clean of all artifacts that came from previous compilations compile
– the project is compiled into /target directory of project root install
– packaged archive is copied into local maven repository (could in your user's home directory under /.m2) test
– unit tests are run package
– compiled sources are packaged into archive (JAR by default)
清洁——所有工件的项目是干净的,从之前的编译编译-项目编译成/目标目录的项目根目录安装,包装档案复制到本地maven存储库(可能在用户的主目录/ .m2)测试-单元测试运行包编译的来源是打包成归档文件(JAR默认情况下)
The 1.6 under tag refers to JDK version. We need to ensure that proper jdk version in our dev environment or change the value to 1.7 or 1.5 or whatever if the application can be supported in that JDK version.
标签下面的1.6是JDK版本。我们需要确保在开发环境中使用合适的jdk版本,或者将其值更改为1.7或1.5,或者在jdk版本中支持应用程序。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
We can find the complete details on Maven build lifecycle in Maven site.
我们可以在Maven站点中找到Maven构建生命周期的完整细节。
#4
23
I had the same problem, check the installed jre used by Maven in your Run Configuration...
我也有同样的问题,请检查Maven在您的运行配置中使用的已安装的jre……
In your case, I think that the maven-compiler-plugin:jar:2.3.2 needs a jdk1.6
在您的例子中,我认为maven-compiler- compiler-plugin:jar:2.3.2需要一个jdk1.6
To do this : Run Configuration > YOUR_MAVEN_BUILD > JRE > Alternate JRE
为此:运行配置> YOUR_MAVEN_BUILD > JRE >备用JRE
Hope this helps.
希望这个有帮助。
#5
14
Sometimes it is caused due to the project points to JRE rather than JDK.So try this,
有时是由于项目指向JRE而不是JDK而导致的。那么试试这个,
1.Right Click on project -->Build Path --> Configure Build Path -->Add Library -->JRE System Library -->Environments--> Installed JREs-->Point to java folder in c: drive (Windows) and select JDK folder and ok.
1。右键单击项目——>构建路径——>配置构建路径——>添加库——>JRE系统库——>环境——>安装了JREs——>指向c: drive (Windows)中的java文件夹,并选择JDK文件夹。
2.Remove the already present JRE from build path.
2。从构建路径中删除已经存在的JRE。
#6
5
Usually, define maven-compiler-plugin is sufficient enough. add the following to your compiler plugin definition.
通常,定义maven-compiler- compiler-plugin就足够了。将以下内容添加到编译器插件定义中。
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
#7
3
I had this problem once, and this is how i resolved it:
.m2/repository
mvn clean verify
) from the terminal at the current project location(where your project's pom.xml file exist) instead of running maven from eclipse.#8
2
Actually, if you do not want to delete your local .m2/repository/... and you are have a downloaded copy of Maven from Apache, you can have Eclipse /STS use that external Maven and you can edit the {maven}\conf\settings.xml to point your localRepository to a new empty location.
实际上,如果您不想删除本地.m2/repository/…您有一个从Apache下载的Maven副本,您可以让Eclipse /STS使用这个外部Maven,您可以编辑{Maven} conf\设置。将本地存储库指向一个新的空位置。
<localRepository>C:\java\repository</localRepository>
Of course, you will have a new repository with all of the maven source downloads in addition to your previous .m2 location.
当然,除了之前的.m2位置之外,您将拥有一个包含所有maven源下载的新存储库。
#9
2
Sometimes this issue comes because the java.version which you have mentioned in POM.xml is not the one installed in your machine.
有时这个问题是因为java。你在POM中提到的版本。xml不是安装在您的机器上的。
<properties>
<java.version>1.7</java.version>
</properties>
Ensure you exactly mention the same version in your pom.xml as the jdk and jre version present in your machine.
确保你在pom中提到了相同的版本。xml作为jdk和jre版本出现在您的机器中。
#10
1
check the property endorsed.dir
tag in your pom.xml
.
I also had this problem and I fixed by modifying the property.
检查属性支持。xml中的dir标签。我也有这个问题,我修改了属性。
Example:
例子:
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
#11
1
- Download maven compiler plugin jar from your central repositoy n try
- 下载maven插件编译器jar从您的*库玩具n尝试
- If it is still failing check your jdk version, it is because of your application is built on diff jdk version
- 如果它仍然不能检查您的jdk版本,那是因为您的应用程序是基于diff jdk版本构建的。
#12
1
For me, restarting Eclipse got rid of this error!
对于我来说,重新启动Eclipse消除了这个错误!
#13
1
I think you have Two ways to solve this problem
我想你有两种方法来解决这个问题
01. Set Properties
01。设置属性
- Set Java Build Path as jdk
- 将Java构建路径设置为jdk
Right click project ->Java Build Path ->Select Libraries tab ->Select JRE System Library ->Click Edit button ->Click Installed JREs-> add tick to box ->click Edit ->Click Directory->Select jdk
右击项目->Java构建路径->选择库标签->选择JRE系统库->点击编辑按钮->点击安装JREs->添加到box ->点击编辑->点击目录->选择jdk。
- Specifi which kind of jdk version you installed
- 指定您安装的是哪种jdk版本
Right click project ->Project Facets ->tick java and select java version->Apply ->Ok
右键单击项目->项目facet ->,选择java版本->应用->Ok
- Update project
- 更新项目
Right-click on "project"->Go to Maven->Update
右键单击“项目”->转到Maven->更新
02.Delete .m2 file
02。删除.m2文件
If you can't solve your problem using above two topic get this action Close your project. Delete your full .m2 folder
如果你不能用以上两个主题来解决你的问题,那就把这个动作关掉。删除完整的.m2文件夹
How to fined .m2 file(windows)
如何罚款。m2文件(windows)
Go to Local Disk(C) ->Users ->Select your PC name ->.m2 file
转到本地磁盘(C) ->用户->选择您的PC名称->。m2文件
#14
1
Java 9 incompatible
I got this error when trying to calling mvn install
on a project.
我在尝试调用项目上的mvn安装时遇到了这个错误。
I had installed Java 9 on macOS as well as Java 8 Update 144. My Maven project was apparently invoking Java 9 and failing. Removed Java 9 from my Mac, leaving just Java 8 in place. Maven is now happily building my project to successful completion.
我在macOS上安装了Java 9以及Java 8 Update 144。我的Maven项目显然是在调用Java 9并失败。从我的Mac上删除了Java 9,只保留了Java 8。Maven现在正在成功地构建我的项目。
Using Apache Maven 3.5.0 on macOS Sierra.
在macOS Sierra上使用Apache Maven 3.5.0。
#15
0
Maybe you can add this dependency to your pom.xml. I use this method and solve the problem!
也许您可以将此依赖项添加到您的pom.xml中。我使用这个方法,解决这个问题!
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3.2</version>
</dependency>
#16
0
for the new users on Mac os , find out .m2 folder and delete it, its on your /Users/.m2 directory.
对于Mac os上的新用户,查找.m2文件夹并删除它,它在您的/ users /上。m2目录。
you wont get to see .m2 folder in finder(File Explorer), for this user this command to Show Mac hidden files
你不能在finder(File Explorer)中看到.m2文件夹,对于这个用户,这个命令显示Mac隐藏文件
$ defaults write com.apple.finder AppleShowAllFiles TRUE
美元的违约com.apple写。仪AppleShowAllFiles真实
after this press alt and click on finder-> relaunch, you can see /Users/.m2
按下alt键后,点击finder->重新启动,可以看到/Users/.m2
to hide files again, simply use this $ defaults write com.apple.finder AppleShowAllFiles false
要再次隐藏文件,只需使用这个$ default write com.apple。仪AppleShowAllFiles假
#17
0
I renamed the .m2 directory, this didn't help yet, so I installed the newest sdk/jdk and restarted eclipse. This worked.
我重新命名了.m2目录,这还没用,所以我安装了最新的sdk/jdk并重新启动了eclipse。这工作。
It seems an SDK was needed and I only had installed a JRE.
似乎需要SDK,我只安装了JRE。
Which is weird, because eclipse worked on the same machine for a different older project.
这很奇怪,因为eclipse在同一台机器上为不同的旧项目工作。
I imported a second maven project, and Run/maven install did only complete after restarting eclipse. So maybe just a restart of eclipse was necessary.
我导入了第二个maven项目,运行/maven安装在重新启动eclipse之后才完成。因此,也许仅仅重新启动eclipse是必要的。
Importing yet another project, and had to do maven install
twice before it worked even though I had restarted eclipse.
导入另一个项目,并且必须在maven运行之前进行两次安装,即使我重新启动了eclipse。
#18
0
It's really incredible to be oblige to erase whole .m2/repository content. I suggest to type this command (On Windows) :
不得不删除整个.m2/存储库内容真是难以置信。我建议输入这个命令(在Windows上):
mvn clean
mvn清洁
mvn -X package > my_log_file.log
mvn -X包> my_log_file.log
The last command enable Debug option et redirect output to a file. Open the file and search ERROR or WARNING key words. You can find this kind of expression :
最后一个命令启用Debug选项et将输出重定向到文件。打开文件并搜索错误或警告关键词。你可以找到这种表达方式:
DEBUG] =======================================================================
[WARNING] The POM for javax.servlet:javax.servlet-api:jar:4.0.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for javax.servlet:javax.servlet-api:4.0.0
[FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7) @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
[WARNING] The POM for org.glassfish:javax.json:jar:1.0.4 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.glassfish:javax.json:[unknown-version]
[FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7) @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
It's esay in this case to understand you have just to delete directory C:\Users\vifie.m2\repository\net\java\jvnet-parent\3
很简单,在这种情况下理解你刚刚删除目录C:\Users\vifie.m2\repository\net\java\ jvnet-parent \ 3
Relaunch compilation, packaging and so on :
重新启动编译、打包等:
mvn package
mvn包
WARNING disappear just because you delete POM file corrupted at the good location and maven re download it. Normally the new POM file is better.
警告消失仅仅是因为您删除了在良好位置损坏的POM文件,然后maven重新下载它。通常新的POM文件会更好。
Often debug mode give you messages with more comprehensive details.
通常,调试模式会给您提供更全面的信息。
Why I redirect log to a file : Simply because on Windows console don't have enough buffer to store all lines and often you cannot see all lines.
为什么我将日志重定向到一个文件:仅仅是因为在Windows控制台没有足够的缓冲区来存储所有的行,而且通常您看不到所有的行。
#19
0
We tried everything listed so far and it still failed. The error also mentioned
到目前为止,我们尝试了所有列出的方法,但还是失败了。这个错误还提到
(default-war) on project utilsJava: Error assembling WAR: webxml attribute is required
(default-war) on project utilsJava:错误组装WAR:需要webxml属性。
The solution that finally fixed it was adding this to POM:
最终解决这个问题的办法是把这个加到POM中:
<failOnMissingWebXml>false</failOnMissingWebXml>
As mentioned here Error assembling WAR - webxml attribute is required
正如这里提到的,装配WAR - webxml属性是必需的
Our POM now contains this:
我们的POM现在包含以下内容:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
#20
-1
i had the same problem and besides the above posts' configurations putting
我也有同样的问题,除了上面的帖子的配置外
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.32</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
</configuration>
<executions>
<execution>
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>
in the plugins element in pom.xml. i think the problem was absence of execution -> goal "endpoints_get_discovery_doc" in some cases like mine, so this worked for me.
在spring .xml中的plugins元素中。我认为问题是没有执行——>的目标“endpoints_get_discovery_doc”在某些情况下就像我的那样,所以这对我很有效。
#1
106
Deleting full .m2/repository
local repository solved my problem.
删除完整的.m2/存储库本地存储库解决了我的问题。
Or else you need to know what plugins are you using exactly with their dependencies as one of the plugin suffered a problem while downloading.
或者你需要知道你用的是什么插件,因为其中一个插件在下载时遇到了问题。
#2
88
Deleting full .m2 local repository solved my problem, too.
删除完整的.m2本地存储库也解决了我的问题。
If you don't know where it is, the locations are:
如果你不知道它在哪里,地点是:
Unix/Mac OS X – ~/.m2/repository
Windows – C:\Documents and Settings\{your-username}\.m2\repository
#3
30
I am adding more points to the solution by @Rushi Shah
@Rushi Shah向解决方案添加了更多的点
mvn clean install -X
helps to identify the root cause.
mvn清洁安装-X有助于识别根本原因。
Some of the important phases of Maven build lifecycle are:
Maven构建生命周期的一些重要阶段是:
clean
– the project is clean of all artifacts that came from previous compilations compile
– the project is compiled into /target directory of project root install
– packaged archive is copied into local maven repository (could in your user's home directory under /.m2) test
– unit tests are run package
– compiled sources are packaged into archive (JAR by default)
清洁——所有工件的项目是干净的,从之前的编译编译-项目编译成/目标目录的项目根目录安装,包装档案复制到本地maven存储库(可能在用户的主目录/ .m2)测试-单元测试运行包编译的来源是打包成归档文件(JAR默认情况下)
The 1.6 under tag refers to JDK version. We need to ensure that proper jdk version in our dev environment or change the value to 1.7 or 1.5 or whatever if the application can be supported in that JDK version.
标签下面的1.6是JDK版本。我们需要确保在开发环境中使用合适的jdk版本,或者将其值更改为1.7或1.5,或者在jdk版本中支持应用程序。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
We can find the complete details on Maven build lifecycle in Maven site.
我们可以在Maven站点中找到Maven构建生命周期的完整细节。
#4
23
I had the same problem, check the installed jre used by Maven in your Run Configuration...
我也有同样的问题,请检查Maven在您的运行配置中使用的已安装的jre……
In your case, I think that the maven-compiler-plugin:jar:2.3.2 needs a jdk1.6
在您的例子中,我认为maven-compiler- compiler-plugin:jar:2.3.2需要一个jdk1.6
To do this : Run Configuration > YOUR_MAVEN_BUILD > JRE > Alternate JRE
为此:运行配置> YOUR_MAVEN_BUILD > JRE >备用JRE
Hope this helps.
希望这个有帮助。
#5
14
Sometimes it is caused due to the project points to JRE rather than JDK.So try this,
有时是由于项目指向JRE而不是JDK而导致的。那么试试这个,
1.Right Click on project -->Build Path --> Configure Build Path -->Add Library -->JRE System Library -->Environments--> Installed JREs-->Point to java folder in c: drive (Windows) and select JDK folder and ok.
1。右键单击项目——>构建路径——>配置构建路径——>添加库——>JRE系统库——>环境——>安装了JREs——>指向c: drive (Windows)中的java文件夹,并选择JDK文件夹。
2.Remove the already present JRE from build path.
2。从构建路径中删除已经存在的JRE。
#6
5
Usually, define maven-compiler-plugin is sufficient enough. add the following to your compiler plugin definition.
通常,定义maven-compiler- compiler-plugin就足够了。将以下内容添加到编译器插件定义中。
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
#7
3
I had this problem once, and this is how i resolved it:
.m2/repository
mvn clean verify
) from the terminal at the current project location(where your project's pom.xml file exist) instead of running maven from eclipse.#8
2
Actually, if you do not want to delete your local .m2/repository/... and you are have a downloaded copy of Maven from Apache, you can have Eclipse /STS use that external Maven and you can edit the {maven}\conf\settings.xml to point your localRepository to a new empty location.
实际上,如果您不想删除本地.m2/repository/…您有一个从Apache下载的Maven副本,您可以让Eclipse /STS使用这个外部Maven,您可以编辑{Maven} conf\设置。将本地存储库指向一个新的空位置。
<localRepository>C:\java\repository</localRepository>
Of course, you will have a new repository with all of the maven source downloads in addition to your previous .m2 location.
当然,除了之前的.m2位置之外,您将拥有一个包含所有maven源下载的新存储库。
#9
2
Sometimes this issue comes because the java.version which you have mentioned in POM.xml is not the one installed in your machine.
有时这个问题是因为java。你在POM中提到的版本。xml不是安装在您的机器上的。
<properties>
<java.version>1.7</java.version>
</properties>
Ensure you exactly mention the same version in your pom.xml as the jdk and jre version present in your machine.
确保你在pom中提到了相同的版本。xml作为jdk和jre版本出现在您的机器中。
#10
1
check the property endorsed.dir
tag in your pom.xml
.
I also had this problem and I fixed by modifying the property.
检查属性支持。xml中的dir标签。我也有这个问题,我修改了属性。
Example:
例子:
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
#11
1
- Download maven compiler plugin jar from your central repositoy n try
- 下载maven插件编译器jar从您的*库玩具n尝试
- If it is still failing check your jdk version, it is because of your application is built on diff jdk version
- 如果它仍然不能检查您的jdk版本,那是因为您的应用程序是基于diff jdk版本构建的。
#12
1
For me, restarting Eclipse got rid of this error!
对于我来说,重新启动Eclipse消除了这个错误!
#13
1
I think you have Two ways to solve this problem
我想你有两种方法来解决这个问题
01. Set Properties
01。设置属性
- Set Java Build Path as jdk
- 将Java构建路径设置为jdk
Right click project ->Java Build Path ->Select Libraries tab ->Select JRE System Library ->Click Edit button ->Click Installed JREs-> add tick to box ->click Edit ->Click Directory->Select jdk
右击项目->Java构建路径->选择库标签->选择JRE系统库->点击编辑按钮->点击安装JREs->添加到box ->点击编辑->点击目录->选择jdk。
- Specifi which kind of jdk version you installed
- 指定您安装的是哪种jdk版本
Right click project ->Project Facets ->tick java and select java version->Apply ->Ok
右键单击项目->项目facet ->,选择java版本->应用->Ok
- Update project
- 更新项目
Right-click on "project"->Go to Maven->Update
右键单击“项目”->转到Maven->更新
02.Delete .m2 file
02。删除.m2文件
If you can't solve your problem using above two topic get this action Close your project. Delete your full .m2 folder
如果你不能用以上两个主题来解决你的问题,那就把这个动作关掉。删除完整的.m2文件夹
How to fined .m2 file(windows)
如何罚款。m2文件(windows)
Go to Local Disk(C) ->Users ->Select your PC name ->.m2 file
转到本地磁盘(C) ->用户->选择您的PC名称->。m2文件
#14
1
Java 9 incompatible
I got this error when trying to calling mvn install
on a project.
我在尝试调用项目上的mvn安装时遇到了这个错误。
I had installed Java 9 on macOS as well as Java 8 Update 144. My Maven project was apparently invoking Java 9 and failing. Removed Java 9 from my Mac, leaving just Java 8 in place. Maven is now happily building my project to successful completion.
我在macOS上安装了Java 9以及Java 8 Update 144。我的Maven项目显然是在调用Java 9并失败。从我的Mac上删除了Java 9,只保留了Java 8。Maven现在正在成功地构建我的项目。
Using Apache Maven 3.5.0 on macOS Sierra.
在macOS Sierra上使用Apache Maven 3.5.0。
#15
0
Maybe you can add this dependency to your pom.xml. I use this method and solve the problem!
也许您可以将此依赖项添加到您的pom.xml中。我使用这个方法,解决这个问题!
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3.2</version>
</dependency>
#16
0
for the new users on Mac os , find out .m2 folder and delete it, its on your /Users/.m2 directory.
对于Mac os上的新用户,查找.m2文件夹并删除它,它在您的/ users /上。m2目录。
you wont get to see .m2 folder in finder(File Explorer), for this user this command to Show Mac hidden files
你不能在finder(File Explorer)中看到.m2文件夹,对于这个用户,这个命令显示Mac隐藏文件
$ defaults write com.apple.finder AppleShowAllFiles TRUE
美元的违约com.apple写。仪AppleShowAllFiles真实
after this press alt and click on finder-> relaunch, you can see /Users/.m2
按下alt键后,点击finder->重新启动,可以看到/Users/.m2
to hide files again, simply use this $ defaults write com.apple.finder AppleShowAllFiles false
要再次隐藏文件,只需使用这个$ default write com.apple。仪AppleShowAllFiles假
#17
0
I renamed the .m2 directory, this didn't help yet, so I installed the newest sdk/jdk and restarted eclipse. This worked.
我重新命名了.m2目录,这还没用,所以我安装了最新的sdk/jdk并重新启动了eclipse。这工作。
It seems an SDK was needed and I only had installed a JRE.
似乎需要SDK,我只安装了JRE。
Which is weird, because eclipse worked on the same machine for a different older project.
这很奇怪,因为eclipse在同一台机器上为不同的旧项目工作。
I imported a second maven project, and Run/maven install did only complete after restarting eclipse. So maybe just a restart of eclipse was necessary.
我导入了第二个maven项目,运行/maven安装在重新启动eclipse之后才完成。因此,也许仅仅重新启动eclipse是必要的。
Importing yet another project, and had to do maven install
twice before it worked even though I had restarted eclipse.
导入另一个项目,并且必须在maven运行之前进行两次安装,即使我重新启动了eclipse。
#18
0
It's really incredible to be oblige to erase whole .m2/repository content. I suggest to type this command (On Windows) :
不得不删除整个.m2/存储库内容真是难以置信。我建议输入这个命令(在Windows上):
mvn clean
mvn清洁
mvn -X package > my_log_file.log
mvn -X包> my_log_file.log
The last command enable Debug option et redirect output to a file. Open the file and search ERROR or WARNING key words. You can find this kind of expression :
最后一个命令启用Debug选项et将输出重定向到文件。打开文件并搜索错误或警告关键词。你可以找到这种表达方式:
DEBUG] =======================================================================
[WARNING] The POM for javax.servlet:javax.servlet-api:jar:4.0.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for javax.servlet:javax.servlet-api:4.0.0
[FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7) @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
[WARNING] The POM for org.glassfish:javax.json:jar:1.0.4 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.glassfish:javax.json:[unknown-version]
[FATAL] Non-parseable POM C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n\n<?xml ... @160:7) @ C:\Users\vifie\.m2\repository\net\java\jvnet-parent\3\jvnet-parent-3.pom, line 160, column 7
It's esay in this case to understand you have just to delete directory C:\Users\vifie.m2\repository\net\java\jvnet-parent\3
很简单,在这种情况下理解你刚刚删除目录C:\Users\vifie.m2\repository\net\java\ jvnet-parent \ 3
Relaunch compilation, packaging and so on :
重新启动编译、打包等:
mvn package
mvn包
WARNING disappear just because you delete POM file corrupted at the good location and maven re download it. Normally the new POM file is better.
警告消失仅仅是因为您删除了在良好位置损坏的POM文件,然后maven重新下载它。通常新的POM文件会更好。
Often debug mode give you messages with more comprehensive details.
通常,调试模式会给您提供更全面的信息。
Why I redirect log to a file : Simply because on Windows console don't have enough buffer to store all lines and often you cannot see all lines.
为什么我将日志重定向到一个文件:仅仅是因为在Windows控制台没有足够的缓冲区来存储所有的行,而且通常您看不到所有的行。
#19
0
We tried everything listed so far and it still failed. The error also mentioned
到目前为止,我们尝试了所有列出的方法,但还是失败了。这个错误还提到
(default-war) on project utilsJava: Error assembling WAR: webxml attribute is required
(default-war) on project utilsJava:错误组装WAR:需要webxml属性。
The solution that finally fixed it was adding this to POM:
最终解决这个问题的办法是把这个加到POM中:
<failOnMissingWebXml>false</failOnMissingWebXml>
As mentioned here Error assembling WAR - webxml attribute is required
正如这里提到的,装配WAR - webxml属性是必需的
Our POM now contains this:
我们的POM现在包含以下内容:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
#20
-1
i had the same problem and besides the above posts' configurations putting
我也有同样的问题,除了上面的帖子的配置外
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.32</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
</configuration>
<executions>
<execution>
<goals>
<goal>endpoints_get_discovery_doc</goal>
</goals>
</execution>
</executions>
</plugin>
in the plugins element in pom.xml. i think the problem was absence of execution -> goal "endpoints_get_discovery_doc" in some cases like mine, so this worked for me.
在spring .xml中的plugins元素中。我认为问题是没有执行——>的目标“endpoints_get_discovery_doc”在某些情况下就像我的那样,所以这对我很有效。