environment:
Eclipse 4.4.2
Tomcat : 7
java 1.7
maven 3.5
STS packages installed.
This is my condition right now. when I made Spring legacy project(MVC) there was some problem in pom.xml.
First of all, Error occurred in war but after I clean the maven and update, the error was gone. but after that, the part of occurred the error. I don't know how to fix it.
But strangely I did this just like same on my other laptop yesterday, There wasn't any problem.
CentOS7
java 1.8
Eclipse 4.7.0
Tomcat 8.5.16
Here is the section of pom file
<plugin>
//plugin execution not covered by lifecycle configuration:org.apache.maven.plugins:maven-compiler-plugin2.5.1:testCompile(execution:default-testComplile, phase:test-conpile)").
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.test.int1.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Once done , try doing a Update Project by Right Click Project , Maven->Update Maven Project and select codebase and do check the Force Update of Snapshot/Release check box.
This will update your maven build and will surely remove your errors with pom.xml
Posting my solution, in case anyone else runs into a similar error. I had a very similar issue on a much later version of Eclipse, etc. No amount of Maven>Update Project solved it.
I ran manually ran "mvn clean install" from the command line, and it cleaned up the errors in eclipse.
Eclipse Neon
maven-compiler-plugin 3.8.1
You need to include the plugins in one of the life-cycles as pointed out by the error. If you want these plugins to be packed in the war file then enclose them in the <packaging></packaging>. But you will be needed to include that in a life cycle.
Related
I have a maven project which work with maven command (for example mvn install)
but when I try to import it into eclipse I got error /complaining about pom.xml
The error message from eclipse is :
Plugin execution not covered by lifecycle configuration: com.google.code.maven-replacer-plugin:replacer:1.5.3:replace (execution: default,
phase: process-sources)
Below is the snippet of pom.xml which eclipse complains
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>src/main/java/com/xyz/Version.java.template</file>
<outputFile>src/main/java/com/xyz/Version.java</outputFile>
<replacements>
<replacement>
<token>#buildtime#</token>
<value>${maven.build.timestamp}</value>
</replacement>
<replacement>
<token>#pomversion#</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
Any hints will be more than welcome!
Since you have shared incomplete pom , I am assuming , you do not have pluginManagement tag in your pom.xml.
Put your plugin blocks inside pluginManagement tag. E.g.:
<build>
<pluginManagement>
<plugins>
<plugin> ... </plugin>
<plugin> ... </plugin>
</plugins>
</pluginManagement>
</build>
The cause of this error is that Eclipse is unable to match some of the Maven build phases to its own build model, because Maven's is more sophisticated than Eclipse's (In this case, it is the process-sources phase, which some plugin is bound to).
But Eclipse offers a way to ignore this plugin, so that this error won't show up again. Open the POM and set the Overview tab. You should see the error message upside. Pass the mouse over and click on it. A popup must appear showing three options. You may chose between the last two:
Mark goal replace as ignored in pom.xml: If you click on this one, Eclipse will modify the POM file to add some declarations that will make Eclipse ignore this plugin.
Mark goal replace as ignored in Eclipse preferences: Though this one, Eclipse will modify its own configuration (Window > Preferences > Maven > Lifecycle Mappings) to ignore this plugin on every POM, from now on.
I'm using maven-bundle-plugin to generate MANIFEST.MF for OSGi container.
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.example.mypackage</Export-Package>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
However, that manifest file got destroyed (overwritten) by Eclipse (4.6.1 Neon) after, f.g Maven/Update Project or Clean/Build.
Is it possible to make Eclipse somehow aware of the maven plugins, and not destroy their output? What should I setup to prevent that (mis)behaviour?
If that issue is not to be fixed with Eclipse, does it work better with IntelliJ, for example? OSGi support within IDE is quite important for me...
I have to change my answer. I missed the part that you define the goal manifest. This is the new and recommended way to use the maven bundle plguin but it requires that you tell the jar plugin to use the existing Manifest.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
old answer
I suspect you are using the Eclipse PDE. The PDE is always working Manifest first. This means it is incompatible with the maven-bundle-plugin.
I recommend to use a plain maven build which we use a lot at apache projects like Apache Karaf or Apache Aries. It lacks the special OSGi support of Eclipse PDE but this sucks anyway.
You can augment this by using the eclipse plugin bndtools. Bndtools now provides maven support to a degree. This means you can now provide maven based OBR indexes for your project and define which bundles to start in a bndrun file. This allows to directly start and debug your OSGi project in Eclipse. See the osgi-chat example on how to do it.
Beware though that bndtools just started with maven support recently. So the current version 3.3.0 still lacks some of the convenience for maven builds.
With my configuration:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>src/main/resources/META-INF</manifestLocation>
<rebuildBundle>true</rebuildBundle>
<instructions>
<Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
And the Plugins installed:
m2e Connector: http://download.eclipse.org/m2e-wtp/releases/neon/
BND Tools: http://bndtools.org/
The Eclipse build finally didn't destroy the manifest file. But there were some iterations(maven build, Update Maven Dependencies, Eclipse Build, maven build) necessary. Also beforehand, I deleted all project related settings on the filesystem: .classpath, .project, .factorypath, .settings, .apt_generated, target. Hope that helps.
I am trying to rebuild Hibernate configuration but i got Wrong Compiler Settings error, please find below screenshots of my App configuration and a of the error:
The problem was because Eclipse ran on a different JVM than the one specified in my project (I have two installed JDK on my machine), to resolve that i just modified the file eclipse.init in a way to ensure Eclipse will run the appropriate JVM.
This is what i added to eclipse.init (you need to use your exact path to javaw.exe):
-vm
C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe
Further informations regarding the eclipse.init file, could be found here.
It seems that you are using maven so you need to adjust it in the compile plugin it your POM
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
for more details check this example
Using eclipse 3.5, when I create a new maven project, m2eclipse automatically adds J2SE1.4 to libraries and Compiler Compliance Level to 1.4 (Project properties > Java Compiler).
My JRE system library is 1.6 and my default compiler compliance level is 1.6. I don't even have 1.4 installed.
Can I make m2eclipse use my default settings and prevent it from modifying project settings?
It should follow the maven-compiler-plugin configuration:
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
(even if, as mentioned in this thread, it won't work for aspect-j)
This thread reminds us about the difference between m2eclipse within eclipse, and a maven script:
One thing worth to mention that this only applies to "the development mode" when m2eclipse is configuring Eclipse tools such as JDT, AJDT and WTP according to the configuration from pom.xml. This is how you normally code and debug your application, run unit tests (with Run as... / JUnit test) or run on web app server (Run as... / Server app).
However if you use Run as... / Maven build..., or create corresponding launch config from the Run/Debug menu, then you can select JVM that is used to launch Maven and all your compiler configuration will be respected in the same way it is respected in the command line.
So:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</plugin>
</plugins>
m2e does not (and cannot) use external java compiler, so it will just ignore these configuration parameters. m2 only considers source/target maven-compiler-plugin parameters.
The JDK compliance level is derived from the maven project, not the other way around. In other words, you need to configure the maven compiler plugin for 1.6 level compliance and then m2eclipse will derive the appropriate settings under Eclipse:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
The pom.xml is the master, not m2eclipse.
In summary I did an mvn eclipse:eclipse on the project and an F5 refresh of the project in Eclipse and this configured the Java compliance setting correctly.
My set-up as follows. Using Kepler. Java 1.7 configured as default in preferences in Eclipse (as mentioned already, seems to be ignored anyway in deference to whatever is found in the pom.xml). I imported a bunch of Maven projects into Eclipse. All showed up as Java compliance level 1.4 and even the build path of the projects lists the Java 1.4 runtime. I double checked 1.7 is correctly specified in the pom.xml by requesting the effective pom on the command line to confirm the setting is present and correct in the pom:
mvn help:effective-pom -Doutput=eff.xml
This showed the correct setting was present:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<fork>true</fork>
</configuration>
</plugin>
Guessing the problem is with the import part of the m2e plugin, version showing in Eclipse is:
1.4.0.20130601-0317
I'm trying to get GWT Hosted mode working in Eclipse, à la this HOWTO. Servlets work fine, as does my GWT code, but all my JSPs fail because with errors such as the following:
[WARN] /view/lniExecutiveSummary.htm
org.apache.jasper.JasperException: /WEB-INF/jsp/lni/lniExecutiveSummary.jsp(1,1) The absolute uri: http://java.sun.com/jsp/jstl/fmt cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
[ trimmed ]
This webapp works fine when deployed under Tomcat 5x; I just can't seem to get it to resolve the taglibs when running in Eclipse.
I'm new to Eclipse, and getting it working with all the moving parts required for GWT+Maven has me pulling my hair out.
Update: I'm no longer using Eclipse; I've switched (back!) to Intellij IDEA. So I can't honestly evaluate the answers you kind folks have posted. Once some voting action happens, or someone else reports success with one of these methods, I'll accept the appropriate answer. Thanks.
I feel your pain. I've gone thru the same pain trying to get gwt, maven, and eclipse to work together.
I've been able to get it working with maven using the following pom.xml. This way you can use mvn gwt:run to run in hosted mode, but unfortunately, I could never get the mvn goal mvn gwt:eclipse for generating an eclipse launch run time config to work.
Here's the relevant snippets from my pom.xml. Note that I've found it easier to install gwt in separate location and point maven to use that instead of having mvn download gwt from repo. The "system" level scope in the mvn dependencies are what make this happen.
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>1.7.1</gwt.version>
<google.webtoolkit.home>${env.GWT_HOME}</google.webtoolkit.home>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>system</scope>
<systemPath>${env.GWT_HOME}/gwt-servlet.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>system</scope>
<systemPath>${env.GWT_HOME}/gwt-user.jar</systemPath>
</dependency>
... other dependencies...
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>com.gwt.example/Application.html</runTarget>
<extraJvmArgs>-Xmx512m</extraJvmArgs>
</configuration>
</plugin>
<!--
If you want to use the target/web.xml file mergewebxml produces,
tell the war plugin to use it.
Also, exclude what you want from the final artifact here.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>target/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<module>com.gwt.example</module>
</configuration>
</plugin>
</plugins>
...rest of pom.xml...
Another technique I've had success with is to use the eclipse google gwt plugin. Just use the wizard to create a new gwt project, make sure that you can run it from eclipse, then modify with your own code.
This webapp works fine when deployed under Tomcat 5x; I just can't seem to get it to resolve the taglibs when running in Eclipse. I'm new to Eclipse, and getting it working with all the moving parts required for GWT+Maven has me pulling my hair out.
You apparently have the JSTL JAR file(s) in Tomcat/lib instead of WEB-INF/lib. You can fix this in at least three ways:
Move/copy the JSTL JAR file(s) into WEB-INF/lib.
Move/copy the JSTL JAR file(s) into Tomcat/lib of your development machine.
Associate the right Tomcat server containing the JSTL JAR file(s) with web project in Eclipse. If not done yet, add the Tomcat server in Servers view. Then in project properties go to Java Build Path > Libraries > Add Library > Server Runtime > select the server in question.
Add the Jar files in eclipse project classpath. if you already had this file tomcat lib. This option will works for you. Second option is add jar in Web-Inf lib folder if you have eclipse web project.
Did you try to mark the "jsf-api.jar" as "exported" in your Java project ?
(as mentioned in this thread)
1.) Go into the java-project properties and mark the "jsf-api.jar" as exported.
(project>properties>java build path>order and exports)
2.) Go into the advanced global tomcat preferences and add your project to
the tomcat classpath (windows>preferences>tomcat>advanced>add projects to
tomcat classpath)
Then, try again to run your webapp under eclipse.
Here is an article describing the same procedure/setup, not for JSF but Hudson (same problem though)
You can clearly see the two steps I mentioned above:
(source: hudson-ci.org)
(source: hudson-ci.org)