Maven Gwt Archetype errors - java

So I tried to get the Maven Gwt archetype up and running. So some background info, I got Maven 3.0, and I have JDK 1.7 in Eclipse.
I ran the archetype, imported the project, and had a bunch of warnings and errors, I solved most of them but this one: GWT SDk servlet.jar was missing in WEB-INF/lib
So I searched stack overflow, and used someones suggestion of using quick-fix to synchronize them. Now I get a warning saying that I have not J2SE1.5 installed.
Do I need J2SE1.5 to run my web app? Why is JDk 1.7 not enough?
Next, I get the warning
Classpath entry com.google.gwt.eclipse.core.GWT_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
Which I also have no clue why it is saying that.
But I am able to run the clean install gwt:run Maven goals without any problems.
I could suppress the warnings but my ADD would kill me, I'd rather understand the issues if I am going to just ignore them.

If you have a GWT_CONTAINER entry in your build-path with a Maven project, then you're doing it wrong (gwt-maven-plugin archetype most probably does it wrong, but I don't have the patience to fix all its warts and nobody else seems to bother; maybe we should simply get rid of it).
You should first install the Google Plugin for Eclipse (GPE), which works hand-in-hand with M2Eclipse (M2E) to autoconfigure the project when it detects it's a GWT project (makes use of the gwt-maven-plugin IIRC).
Then make sure you don't have any .project, .classpath or .settings/ files/folders and import your Maven project in Eclipse. M2E and GPE should do everything for you. In the event that GPE doesn't add the GWT nature to your project, go check "Google Web Toolkit" in the project preferences, you'll see that GPE will have automatically selected the gwt-user from your POM as the GWT SDK.
See http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven (which suggests avoiding the gwt-maven-plugin archetype).
All in all, it's easier to simply start from scratch: add a dependency on gwt-user and add the gwt-maven-plugin, then do everything else with GPE wizards in Eclipse.
You might also find https://github.com/tbroyer/gwt-maven-archetypes helpful.

Related

Exporting Eclipse plugin not able to see project as plugin project

I am working on Eclipse plugin. At the beginning exporting of it worked fine but I guess that after updating Eclipse it broke down. Eclipse started to mentioned that I have uninstalled some equinox packages. It took time till I understood that version of Eclipse made a problems and I reinstalled older version of Eclipse. Now I am again able to run sample environment with plugin but I still am not able to export plugin. In export form where I need to select deployable plugin and/or fragments I don't have listed anything. From what I found I understand that it might be problem with importing project in Eclipse as it might not remove information that project is external and thus not listing as project that could be exported. But I did not find any way to prove this case.
Is there anybody having any idea how to solve this kind of issue?

Make maven generate dependencies even with errors

This feels like a really stupid question but I haven't been able to find an answer.
I'm working on a maven project but I do most of my development in eclipse. Is there any way for me to force maven to generate all of my dependencies under target even if there are errors in the code? I set my eclipse project's build path to use the jars under target/dependencies/jars, but calling mvn clean kills them and if there are any errors in my code causing it to not compile mvn package won't create the dependencies but will instead just crash saying BUILD FAILURE. This makes the problem even worse since instead of seeing the actual errors my eclipse will just bombard me with errors everywhere since all of its dependencies just died.
Or maybe the way I'm working with it is just stupid and there's a better way.
Are you using the m2e plugins for Eclipse to process maven projects, or simply importing the projects as general ones?
If the latter, you should use the m2 plugins (simply go to the Eclipse Marketplace and search for Maven), as they interrogate your POM and set up your dependences properly. You can then concentrate on any compile errors in your code.
You should not point to the jars in the target folder for dependent JAR's since this is where the products of building your project are stored. Performing a mvn clean removes this folder.
To use Maven with Eclipse install the m2e plugin in Eclipse. This makes Eclipse understand the structure of Maven projects.
Once installed you can import your Maven project into Eclipse. I use Import... | Existing Maven Projects for this. But you can also directly import form a versioning system.
During the import Eclipse will set up the Eclipse project to use the Maven dependencies to locate the required JAR's. These are taken from the repository as configured with the used Maven installation.

Problems installing maven2eclipse offline

I've been dealing with this problems for days now.
I need to install maven and the eclipse plug-in "maven2eclipse" on an offline environment.
So far I've installed maven on the computer but I'm not able to import or open a maven project in eclipse when I right click and select "import source" in the package/project explorer. Maven alternatives simply aren't there for me to use even though I've installed all of the plug-ins that m2e repository has to offer.
I've downloaded the m2e-repository for a local version with these commandlines:
Artifact and metadata (replacing .artifact. with .metadata. and running it again)
"C:\eclipse Java EE\eclipse.exe" -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication \ -source http://download.eclipse.org/technology/m2e/releases \ -destination C:\Maven2Eclipse\repos
I then moved this local folder to the offline system and used it as a local repository.
I've also downloaded the helios repository, but I haven't installed anything from it. Becuase I seemed to be lacking some important dependancies without it. Something with eclipse.UI.. haven't been able to reproduce it.
Anyways, I've added the downloaded repositories to the disposal of my offline environment.
I installed everything with "m2e" and/or "maven" in it's name but I still can't import an "existing maven project". The option simply isn't there.
Here's a screenshot of what m2e software I have installed using the "install new software".
http://i.imgur.com/xPKN6qn.png
Have I missed something? There's something missing and keeping me from actually being able to select the import source "import an existing maven project".
I've been searching the web like crazy and I cannot find anything that resembles my problem.
There's quite a lot on mirroring eclipse repositories and what not but I don't seem to have a problem whit that, unless something didn't get downloaded.
Thanks in advance for any help.
It is better if you can update eclipse with the automatic update by using the url online directly.downloading and then installing the plugin manually causes a lot of issues as some plugins might not get downloaded properly in the installer or some plugins may be completely missing from the installer itself.
Please check the proper url to install the plugin automatically which matches with the version of the eclipse you may be using.
Just...check this two things, if you go in eclipse configuration, inside the Maven tab?
1: Check the Offline mode...
2: Try to use the Maven you've installed (not the embedded one..)
I solved the issue by manually copying all plugins and feature files into their respective folders, making sure everything was installed as well and then restarting eclipse a couple of times with the -clean addition. After that, it started working.. weird :/
Thanks for the answers though!

Eclipse throws NullPointerException during Maven update

I've been fighting an internal Eclipse error for two days. I'm running the latest Spring Tool Suite edition of Eclipse, and I've attempting to import a collection of existing Maven projects. Whenever I do so, Eclipse throws a NullPointerException, but no stack trace is available from the Error Log view. If I instruct Eclipse to update the Maven project (Maven > Update Project), I get a NullPointerException again. This time, the Error Log view reports the following stack trace:
java.lang.NullPointerException
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePaths(VirtualResource.java:119)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingFiles(VirtualFile.java:104)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingResources(VirtualFile.java:93)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.exists(VirtualResource.java:88)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getNonBinaryComponentManifest(ManifestUtilities.java:124)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifest(ManifestUtilities.java:81)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifestClasspath(ManifestUtilities.java:147)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getManifestClasspath(J2EEModuleVirtualComponent.java:248)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.calculateManifestReferences(J2EEModuleVirtualComponent.java:368)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.cacheManifestReferences(J2EEModuleVirtualComponent.java:360)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:176)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:214)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:207)
at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configureClasspath(WebProjectConfiguratorDelegate.java:386)
at org.eclipse.m2e.wtp.WTPProjectConfigurator.configureClasspath(WTPProjectConfigurator.java:107)
at org.eclipse.m2e.jdt.internal.DefaultClasspathManagerDelegate.populateClasspath(DefaultClasspathManagerDelegate.java:61)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:253)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:363)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:343)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:371)
at org.eclipse.m2e.jdt.internal.BuildPathManager.updateClasspath(BuildPathManager.java:191)
at org.eclipse.m2e.jdt.internal.BuildPathManager.mavenProjectChanged(BuildPathManager.java:180)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:746)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:865)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:289)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:369)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:316)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:161)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:89)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1301)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:313)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Here's what I've tried:
I've blown away my workspace and created a new one. Multiple times.
I've blown away my Maven repository so that it would be re-created.
I've reinstalled Spring Tool Suite.
I've tried asking Eclipse to update the Maven repositories.
I've checked for merge conflicts in my local SVN repository. (There are none; this is a brand new branch from trunk that is freshly checked out.)
I've checked the Synchronize view in Eclipse to see if it notes any differences. (Eclipse can't get far enough to recognize any projects available to synchronize.)
I've searched Google for NullPointerExceptions occurring in VirtualResource.getProjectRelativePaths(). I've found NullPointerExceptions in other very similar places, and I've tried the recommendations for them, just for the heck of it, but none of them work.
I'm at my wits' end with this problem. Help me, Obi-Wan Kenobi, you are my only hope.
This is what I did to fix it:
Removed the project from the workspace
Remove .classpath, .project and .settings folder
Reimport the project
I'm strongly sure that the problem is not related to the maven plugin; but if it is, i was wandering if you run a mvn eclipse:eclipse before importing the project into eclipse, if you do that and you are using maven 3, I had checked that maven plugin does not support maven 3 properly yet; so I encourage you to make a mvn eclipse:clean, then import the project as an existing project, and after that activate the maven plugin nature from eclipse.
I hope it helps,
PS. it seems to be a know eclipse bug (https://www.google.com.uy/search?q=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&oq=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&aqs=chrome..69i57.128j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8); try downloading the last eclipse version; I'm using kepler at work, and I'm working in maven/spring projects and it works fine.
Good luck!
This happens because your m2e plugins are corrupted. To rectify follow the steps below.
close eclipse
Go to your eclipse workspace folder Under .metadata/pluigns folder, identify all m2e plugins
delete them
copy the relevant plugins from non-corrupted workspace, either from
your machine or from any one of your team members machine
restart eclipse
As echinelli indicated, this did turn out to be an Eclipse (or STS) bug, but installing the latest version isn't the fix, as I already had that version installed. I had installed STS based on Eclipse 4.x; when I uninstalled that and went to the 3.x version, the problem went away.
Ok, I had the same issue with a more obscure reason.
I used pluginExecution for aspectj-maven-plugin and over the course of trying to fix yet another maven issue I had commented out <action><execute><execute></action>
This leads to the nullpointerexception.
I solved by adding the <build> section with "maven-compiler-plugin" artifact in the POM. I noticed that without it, Eclipse threw a java.lang.NullPointerException.

java compilation error

I'm expiriencing multiple compilation errors in my project, most of the code is in red, but the strange(or not) thing is that while building the project with maven everything is build successfully and the war is assemled as it should be.
The thing is that auto suggest is not working because code is not compiling. What can I do to fix this?
I'm using eclipse, sorry
UPDATE:
I've tried all suggestions below but none worked
If you are using Eclipse, try Project > clean.. your project.
I don't know why, but Eclipse sometimes just think your project was wrong but it's not. Clean it to entirely build it again.
If it's Eclipse do
Project > Clean
then right click at the parent-most project and do
Maven > Update Project Configuration
Maven > Update Dependencies
I guess you have m2eclipse installed, already.
Use a maven plugin in your IDE
plugin for eclipse
plugin for netbeans
Most likely you have to include external libraries/dependencies in your IDE. It seems when you're building with maven, those dependencies are solved for you.
Some IDE's support Maven projects, try to see if yours does.
You haven't specified what IDE you're using or what the errors are, which makes it pretty hard to give you advice. My guess is that you haven't configured your project (or whatever the equivalent IDE concept is) to tell it the libraries you're using... whereas the Maven build file already contains that information.
EDIT: Okay, so it can't find the right libraries. Options:
Use a Maven plugin and let it manage the project
Edit the project's build path and explicitly tell it which jar files to use.

Categories

Resources