I would just like to setup a new GWT project in Eclipse and use Maven for dealing with all the jar jungle. I used gwt-maven-plugin with this instructions, but I can't get the project to work in Eclipse.
What I've actually done:
Created a maven project using the archetype gwt in command line.
Imported the projet in eclipse using import > existing maven project
While doing that I had errors saying:
gwt-maven-plugin:2.3.0-1:generateAsync - "No marketplace entries found to handle"
gwt-maven-plugin:2.3.0-1:i18n - "No marketplace entries found to handle"
gwt-maven-plugin:2.3.0-1:exploded - "No marketplace entries found to handle"
These errors don't go away even if I ignore them on the import.
How can I make these projects working? Is the problem that I skipped the "process-resources" setting? (There is no such setting in the latest version of m2e.)
Should I even use gwt-maven-plugin? Is there any other way of making a GWT project to use Maven? Or – is there any other way to fight with the jar jungle? What does GWT guys use?
I use Eclipse Indigo with m2e plugin 1.0.0 and Google suite plugin version 2.3.3.
Eventually I gave up Maven. As one other developer said "good ideas and bad code build communities faster" , I also remember my experience with Maven on all the projects: very promising on the beginning, but eventually you get to some problems and end up working more with configuring Maven than actually dealing with your own code.
I decided to manually copy needed .jar-s into /lib folder. I spent some time due to transitive dependencies, but LESS than dealing with Maven and now I have things under control. If sometime in the future working with libraries will become an overhead, I will consider using Ivy.
If someone wishes to stick with Maven, I lately found a very useful link by Google team:
http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven
They recommend using their sample projects and not gwt-maven-plugin archetypes (due to issues). I agree. They also provide needed pom lifecycle changes for Eclipse Indigo.
According to a recent post on the gwt-maven-plugin mailing list the Maven integration is not complete for Eclipse Indigo, since the M2Eclipse 1.0 release has brought about a large number of changes. The suggested workarounds from David Chandler, Google engineer, are:
You can run "mvn package" on the command line or right-click on the project > Maven > Run as > Maven build.
The plugin execution failures you're seeing can be resolved by adding lifecycle mapping metadata as in the sample POMs. They are only needed for Indigo. You should not get these errors in Helios or when running mvn package from the command line.
Disclaimer: The following guidelines are for Windows users. These steps are on the basis that, they have worked when tried by the replier and doesn't guarantee fulfledge working unless experimented by self and tried with proper prerequisites.
::Creating a simple gwt project using archetype::
Following are few commands that can be used to create a simple gwt project "Web Starter Application":
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo
-DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0
mvn -DarchetypeGroupId=org.codehaus.mojo
-DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0 -DgroupId={project packaging} -DartifactId={application name} -Dversion=1.0 org.apache.maven.plugins:maven-archetype-plugin:generate
mvn -DarchetypeGroupId=org.codehaus.mojo
-DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0 -DgroupId={project packaging} -DartifactId={application name} -Dversion=1.0 -Dmodule={module name} org.apache.maven.plugins:maven-archetype-plugin:generate
(The value of archetypeVersion can be 2.3.0 or any higher stable version.)
Few coordinates are required by maven to create the gwt project. They are as follows:
groupId
artifactId
version
module
The first command doesn't take any of the above coordinates hence, we need to supply them at the time it executes. Notice that the archetype goal is mentioned right at the beginning of the command. It is mandatory to give the archetype goal.
The meanings of these coordinates can be found here.
One of the best ways to start with understanding maven is this.
The second command doesn't consider the module name hence, you will be prompted to give it at the time the command executes.
The third command is equivalent to running it in batch mode where you just have to confirm the inputs for groupId, artifactId, version, module as mentioned in command itself.
Once any of these commands gives a BUILD SUCCESS result, then navigate to the just-now-created project folder from command line and execute the following command:
mvn gwt:run
It should start the project in Development Mode so that you can Launch the Default Browser to run the project or Copy the URL to clipboard and navigate to it through any browser.
Good luck with the execution.
Related
I am trying to achieve the following between Eclipse and Gradle:
Allow Gradle to handle 100% of my local build logic; only use Eclipse as an IDE for syntax highlighting, refactoring, etc. Every time I wish to build my app I want to drop into a command line and run a Gradle build invocation from there.
I want the dependencies closure of my build.gradle file to be the sole location for configuring 3rd party dependencies; every time I make a change to this closure (adding/removing a dependency/JAR), I want Eclipse to automagically "see" this change and adjust my project's classpath accordingly
I installed the Gradle-Eclipse Integration plugin and then I followed this tutorial for configuring it correctly.
First I ran:
gradle clean build
And then I added:
apply plugin: 'eclipse'
To my build.gradle, and then ran:
gradle eclipse
I saw a lot of output, the tail end of which is:
gradle eclipse
:myapp:eclipseClasspath
Download http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2-sources.jar
Download http://repo1.maven.org/maven2/org/sonatype/sisu/inject/cglib/2.2.1-v20090111/cglib-2.2.1-v20090111-sources.jar
Download http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1-sources.jar
Download http://repo1.maven.org/maven2/com/google/inject/guice/3.0/guice-3.0-sources.jar
Download http://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.3.7/groovy-all-2.3.7-sources.jar
Download http://repo1.maven.org/maven2/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar
Download http://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1-sources.jar
:myapp:eclipseJdt
:myapp:eclipseProject
:myapp:eclipse
I then opened my .classpath file and see that its been correctly updated with all the transitive dependencies defined in my dependencies closure back inside build.gradle.
However, there is not visual indication inside Eclipse that anything is wired correctly. With Ivy or Maven, you usally get something like a Ivy Repository Manager or Maven Dependency Library that automatically changes anytime you modify ivy.xml or pom.xml.
Most importantly, this just doesn't seem to be working! As you see above, Apache Commons Lang 3 is a dependency, but when I try to add org.apache.commons.lang3.exception.ExceptionUtils to a Groovy source file, Eclipse can't find it. I have already tried restarting Eclipse to see if that shook any bugs out.
Am I just not using this plugin correctly, or does it just not work? Using Groovy/Grails Tool Suite 3.6.0.RELEASE here, which is based on Eclipse Luna 4.4.
I'm trying to import Mahout's maven resource to eclipse, but i meet these errors:
I have tried google but it doesn't help.
Eclipse : Helios Service Release 1
Maven : External Maven 3.
Edit: If I try to play with latest stable release ( Mahout 0.7 ) and not the latest snapshot that the official site recommends for downloading, I experience the same error.
Follow step-by-step this link: https://cwiki.apache.org/MAHOUT/buildingmahout.html
After doing this and re-importing mahout, these errors you noticed go away.
Notice: Before compiling the code in the right way (as stated at the link above), I have followed the instructions from here:
http://domengrabec.wordpress.com/2010/12/14/installing-maven-on-eclipse/
Q: If anyone could help me with this related issue:
Include classes of Mahout math libraries of both core & math folders - Eclipse - Hadoop , I would be grateful.
I think what you need is to build mahout in a different way,
first install m2e plugin for eclipse, then you can create maven project. You can make the run configuration (package) after that to make sure everything is fine.
The important part is that you have the pom.xml in the project so you have to add the dependencies of mahout that you want.
You can get the dependencies from searching on google " name of the dependency in mahout api".
i solved it by manually applying the patch in https://issues.apache.org/jira/browse/MAHOUT-1043 to 0.7 sources (changes pom.xml files and src/conf/driver.classes.conf )
just one note, do not remove the groupid in distribution/pom.xml
launch an external mvn eclipse:clean and update the projects. All errors are gone when workspace is rebuilt
Update
The reason I couldn't update properly was I didn't have game's jar file properly installed. That was fixed by first running this on the command line:
mvn install:install-file -DgroupId=com.mygame -DartifactId=mygame-core -Dversion=0.9-beta -Dpackaging=jar -Dfile=/home/klenwell/projects/mygame/playn/mygame/java/target/mygame-java-0.9-beta.jar
Then, in Eclipse, I right-clicked java folder > Maven > Test. This updated all my dependencies including lwjgl.
Otherwise, see thomasbroad's answer.
Original Question
I've consulted the following authorities on this topic and applied their various recommendations:
http://lwjgl.org/installation.php
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Maven
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Eclipse
https://stackoverflow.com/a/11065814/1093087
https://groups.google.com/forum/?fromgroups#!topic/playn/E2t7gNh4ab0
https://groups.google.com/d/msg/playn/3D4JZ1Dbm-E/HmPHofS2fqgJ
Part of the problem is I'm not sure whether I should be following the Maven instructions or the Eclipse instructions. I've tried both and everything in between.
I'm working in Ubuntu 12.04 64-bit on Eclipse using Maven. Everything was working fine until I changed the PlayN version in my POM file from 1.2 to 1.3.1 and introduced the lwjgl dependency.
What I would have expected to have worked:
1) Download lwjgl (latest version 2.8.4) and test per lwjgl.org instructions (this was successful)
2) Update the appropriate POM files
2A) Add lwjgl.version as a property to mygame/pom.xml
<properties>
<playn.version>1.3.1</playn.version>
<lwjgl.version>2.8.4</lwjgl.version>
</properties>
2B) Add lwjgl as a dependency to mygame/mygame-java/pom.xml
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>${lwjgl.version}</version>
</dependency>
3) Right-click mygame-java project in Eclipse > Run As > Run Configurations > Arguments and add either -Djava.library.path=target/natives or -Djava.library.path=/absolute/path/to/my/lwjgl/lib to VM arguments. (I've tried both variations.)
I can see the dependencies listed under my java project folder in Eclipse. And when I follow the lwjgl.org guide for Eclipse, I can see the jar listed under the java project folder. But I still get the error.
After two hours of hair-wrenching frustration, I hope somebody can either point out my fatal oversight or provide explicit instructions that will help me get back to work. Thanks.
I upgraded my project from 1.2 to 1.3 a while ago. I only updated my pom.xml files to refer to the new version of PlayN . I did not manually install lwjgl and neither did I add the lwjgl dependency as that one is implicitly pulled in by PlayN
Manually apply the diffs found here to your project, to your poms.
The key part being the piece in the java pom that tells Maven to unpack native dependencies. This part was actually added in the previous diff, so you may want to look there as well.
Now your IDE will most likely tell you that your project is not up-to-date with your poms, update your project, this should pull in the lwjgl dependency and set it up correctly.
I believe you should add the -Djava.library.path arguments to the VM Arguments, not to the Program Arguments in your runtime configuration.
The other -using maven- option is described on the Getting Started page, it worth noting, that the default embedded Maven is buggy for development, you should download and use at least Maven 3.0.3 as it is mentioned on the page (but I guess you already do this).
I just started a new project fresh with PlayN 1.4 and encountered this issue again in Eclipse. Resolved it as follows:
Right click mygame-java > Run As > Run Configurations...
Then added the following to VM Arguments under Arguments tab:
-Djava.library.path=target/natives
Then successfully ran as application.
At one point, I also ran the mvn install:install-file... command mentioned in question but I'm not sure whether that was necessary or not.
I have just upgraded my SpringSource Tools Suite (STS, a variant IDE of Eclipse) to the latest version (v3.6.1). Then all my JUnit unit tests can not be run again. I am getting this error:
Class not found ClassToTest
java.lang.ClassNotFoundException: ClassToTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
According to this blog:
ClassNotFoundException when running JUnit unit tests within Eclipse (using Maven),
it is because of some misconfiguration of Maven plugin in Eclipse. However, in STS 3.6.2 I cannot find this option "Include Modules" in the Maven plugin. How can I fix this problem and re-enable my unit tests?
There are still some back-draws on the current m2e plugin. Unit-test-cases couldn't be run as their including project grouped in a working-set. Following may help:
Right click on project including junit-tests.
Select Maven -> Disable Workspace Resolution
Try then to run your test again.
OK it seems I'll have to answer this question by myself.
The main reason for this problem is still the m2eclipse eclipse plug-in. The new version of this plugin does not support nested modules in one project. If we really need to see multiple modules we have to remove the old one from the package explorer and create a working set and import the project again using the option "import existing maven projects". The eclipse import wizard will pop up a window and ask you which module to be imported. Then we can select all the modules and finish the import. As a result the working set will contain all the modules of your project and treat each module as a separate project, although in the workspace your modules are still in one project. By doing this it resolves all the problems that I have come across in Eclipse related to classpath, such as not being able to search a class or not being able to run the unit tests and get a java.lang.ClassNotFoundException.
For reference, here is an article to teach you how to create a working set:
Working set
I think you can import the project without creating a new working set but the working set will keep all the modules that belong to your project in one set so it is easier to organize.
I wish I had the answer two months ago so I wouldn't have spent much time searching for a solution.
I think I have found the solution, at least this worked for me:
right click on the project and choose 'Maven' -> 'Update Dependencies'
Then when I tried , I did not get ClassNotFoundException .
I tried everything mentioned here and in other posts. Some of the solutions that people proffered were:
Change the output folder for the test classes.
Create a custom builder for the project that would run test-compile from Maven.
Move the Maven dependencies higher in the Order and Export list in the project build path.
There were many, many more but the one that I found to work was as follows:
Close the development environment.
Delete the jars used by the project from my local Maven repository.
Open the IDE.
Build the project.
Run the test.
After hours of beating my head against my keyboard and following suggested solutions, this one worked!
We too faced the same ClassNotFoundException while trying to run JUnit test class. But when we tried using the following steps, it successfully started running.
Select your project.
Click on the project option displayed in toolbar in the eclipse IDE.
Select “clean”.
Now try running the test file.
As a work-around, try running mvn test-compile (either in Eclipse or from the command line), then try running the Junit test within Eclipse.
I want to create a web app that will use wicket, hibernate and spring frameworks. My IDE of choice is Eclipse, I am using maven for the .war generation and I am running Mac OS. What steps should I follow to correctly install and configure all the tools so as to have a project running that relies on these 3 frameworks. I was able to successfully set up wicket but I am having trouble for setting up hibernate and spring. I went through multiple tutorials but I still couldn't find the solution.
Thanks!
I will now try to explain a bit what is the problem I can't solve. I first began with a clean project:
mvn archetype:create -DgroupId=test.framework -DartifactId=microForum
Moved on to the project folder and mvn eclipse:eclipse
Imported the project from eclipse
Looked into the apache wicket homepage where there are multiple examples, so I read through the page and that was enough to learn what to add to the pom and had wicket and everything up and running nicely
My next step was trying to use hibernate and/or spring. I thought that "adding" hibernate and spring in the same way I added the wicket necessary configurations and dependencies to the pom (by hand) might not be that easy. So I tried using the maven archetype: appfuse-basic-spring. So:
mvn archetype:generate -> launchs the wizard that lets you choose among different archetypes
After choosing the archetype number 2 ( Hibernate + Spring + Spring MVC) it fails
After googling a bit I found out why it fails (something like I should add a -archetype after appfuse-basic-spring. So, instead of using the wizard, I put:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring*-archetype* -DarchetypeVersion=2.1.0-M1 -DgroupId=test.framework -DartifactId=microForum2
This created my project (after multiple warnings). I paste a screenshot (Image 1) because some of the information might have some important meaning :
http://img97.imageshack.us/img97/6687/screenshot20100323at112.png
- Image 1
I then did mvn eclipse:eclipse and it started downloading millions of things, which seemed very odd so I Control+C it.
Following schmimd04 answer I tried to use the eclipse maven plugin but I couldn't create a maven project:
Unable to create project from archetype [org.appfuse.archetypes:appfuse-basic-spring:RELEASE]
The defined artifact is not an archetype
Thanks!
p.d: My Mac OS already had maven installed (version 2.2.0), I tried downloading the last one and repeating the same steps but I still had the same trouble.
Bert's recommendation LegUp, jweekend.com/dev/LegUp, have worked just fine for me. I used the wicket + Spring + JPA archetype. I will still look for the reason why maven's Hibernate+Spring+Spring MVC archetype didn't work for me. I'll edit this once I have the answer. For the time being, legup did the job!
Thanks
Install the Maven plugin for Eclipse from the update site: http://m2eclipse.sonatype.org/update.
This will allow you to create Maven projects (I would start with the quickstart archetype) and easily add dependencies, such as Hibernate, Spring, and Wicket.
As Pascal is saying, your question is to broad to answer. A few pointers that might help you:
use 'mvn eclipse:eclipse' to generate an Eclipse project out of your pom.xml. There might even be a working eclipse project that allows to open a pom.xml as eclipse project. I can't say, i left eclipse behind for good.
spring is 'just' a library that need to be in your classpath. the above command will ensure it is there (if it is defind as dependency in the pom.xml) You need to define a applicationContext.xml for Spring that resides in your classpath. See the Spring documentation for that.
hiberate is similar, it is just a library that needs to be in the classpath and that needs to find a config file. in there, the connection to the database is described. See the hibarnate docu (or one of the many blogs out there) for more info.
If you are stuck with a particular problem, please describe it so people can help here.
Bert
I don't know if it sounds odd. But it is because you have archtype data in your .metadata for respective workspace. If you delete the workspace. You can create new archtype. I know deleting worksapce is not a good idea. But still it works.