NetBeans + GWT 2.2.0 + Maven compile problem - gwt

I'm trying to create a Maven Web Application project with Google Web Toolkit in NetBeans 6.9. I've followed the steps shown on this video: http://www.youtube.com/watch?v=M-iVZ5TJ21w
After creating the project and adding GWT to the frameworks my project compiles and deploys to Tomcat nicely. Now i like to change the default GWT version from 2.0.3 to 2.2.0. As i edit the gwt.version property in the POM and save the file, NetBeans fetches the new gwt-user-2.2.0.jar file and the javadoc. However if i try to compile the project i get this Maven error in the console:
Downloading: http://repo1.maven.org/maven2/com/google/gwt/gwt-dev/2.2.0/gwt-dev-2.2.0-linux.jar
Unable to find resource 'com.google.gwt:gwt-dev:jar:linux:2.2.0' in repository central (http://repo1.maven.org/maven2)
If i point my browser to the URL http://repo1.maven.org/maven2/com/google/gwt/gwt-dev/2.2.0/ i can see that there's truly no gwt-dev-2.2.0-linux.jar present. However i can see there a gwt-dev-2.2.0.jar which i think will be the correct one to use.
What should i do to fix this error?

You're probably using old version of gwt-maven-plugin. Switch to 2.2.0 or remove version declaration and it'll fetch newest version.
It's also possible that you have some old-format dependency for GWT in your pom. There used to be tag required for old GWT versions. If you have one you can remove tag and it will fetch system independent version without -linux suffix.

Related

Setting up Eclipse and Maven to build a simple Jersey Webapp

I had this working previously but had to reinstall everything because my hard drive died. I'm trying to build a simple jersey application via the archetype jersey-quickstart-webapp. The code is unchanged from the archetype so it's unlikely an issue with that as I had it working before the PC issue.
I'm fairly certain it's an install issue with Eclipse or Java or something else. My timeline of events goes as follows. I created the archetype project and got this error:
Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:pom:2.2 from/to central (http://repo.maven.apache.org/maven2): connect timed out -> [Help 1]
From this I searched for solutions which included deleting the repository folder and everything in .m2, forcing the project to update dependencies etc.
While doing this I noted that the option to Run As-> Run On Server was not available as an option.
I went to manually add Project Facets > Dynamic Web Module, it said this requires Java 1.6 or newer. So I tried to lower the version all the way down to 2.2 which needs Java 1.3, none allowed me to check the box. I have Java 1.7 JDK installed.
This is where I stand. Can anyone please help!!?
Plugins installed into eclipse are: M2E, Collabnet Merge Client, Eclipse WTP

Maven Eclipse Integration

I have recently started out on Maven. I am trying to integrate Maven+eclipse(Juno)+tomcat7.
I have downloaded m2e-wtp plugin for eclipse and created a Maven project whose structure follows a standard Maven project structure. It is also configured a dynamic web project.
It is a multi module project with two modules of flex(f1 AND f2) and one module of webapp(w).I have configured all the plugins correctly and there is no problem with configuration of POMs.
What I want to achieve is :
When I clean and Build project in Eclipse using Project-->Clean,Eclipse does not build the war in target folder of my web application project (w). I also does not copy any of the flex resources to target folder. However,
When I run the project as maven build by right-clicking the web application project and running it as a "maven install" it creates everything as expected.
My question is that if it is possible to achieve what I mentioned in point (1)? Or the only correct way to do this is the way mentioned in point (2).
I am also not able to deploy the generted files in step 2 automatically in tomcat.
Do I need to use another maven plugin for this?
Please note that this i my first experience with Maven + eclispe. I have followed certain tutorials. So, Please be lenient while voting negatively.
From what I know it is not possible to force Eclipse to use Maven directly (I would gladly be proven wrong).
Eclipse does not use Maven to build (1). Using the m2e plugin, it is possible to run maven to perform the build as you discovered (2).
If you are looking for that kind of tight integration you can look at NetBeans or IntelliJ who are using Maven natively.
EDIT:
About (3) there is a Tomcat-Maven-Plugin that can deploy the WAR file created on a running tomcat instance. Check the Usage page for more details.

spring-web maven dependency not being published with eclipse

My gae + spring + maven project works perfectly. But I can't make it work using eclipse.
Seems like the spring-web dependency declared in my pom.xml is disappearing from WEB-INF/lib when I run my project using GAE from eclipse (using Google Plugin, Run As > Web Application). So without spring-web this is the exception:
Could not instantiate listener org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
(Full GAE stacktrace here)
From console, running mvn clean package gae:run, the app works like a charm and spring-web is placed under WEB-INF/lib directory as expected.
Just published my test project at BitBucket: https://bitbucket.org/jelies/gae-spring-maven
Any idea why spring-web is not being published to WEB-INF/lib when launching webapp from eclipse?
Using:
SpringSource ToolSuite 3.1.0 (based on eclipse 3.8)
Java 6
Spring 3.2.1
Maven 3.0.4
Google App Engine 1.7.5
maven-gae-plugin 0.9.6
Update: spring-web dependency is being published to WEB-INF/lib when using spring version 3.1.4.RELEASE. This is not happening with any 3.2.X version.
Added a Jira issue for this problem with my configuration (Eclipse 4.2, WAS 7.0, mvn 3): https://jira.springsource.org/browse/SPR-10494
If your .classpath file has the entry <classpathentry kind="output" path="target/classes"/>, try changing it to your WEB-INF/classes dir. Mine is set up with maven standards, so I changed this line to <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/>. This just fixed my issues (Eclipse Juno, WAS 7, no m2e install).
Also, in case it applies to others, I should mention that with my server (Websphere) I am choosing the "Run server with resources within the workspace" publishing setting.
This issue shows how much I really don't understand Eclipse's publishing still, but before that change when I chose the "in workspace" setting it actually published my resources to \workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0 and the WEB-INF\lib did not contain spring-web. However, with the change above I'm no longer seeing my code published to that directory. I'm not exactly sure now how my server is getting the binaries it needs, but it appears to be working.
As a side note/added bonus (maybe completely unrelated), I no longer need to do a publish to see updates to my JSPs when I make changes to them.
This fixed it for me:
Find the location of the spring-web.jar this is being included in you web app. In my case its in user.m2\repository\org\springframework\spring-web\4.1.6.RELEASE\spring-web-4.1.6.RELEASE.jar
Open spring-web-4.1.6.RELEASE.jar en eg. 7zip
Delete this file from the jar: META-INF\web-fragment.xml (in 7zip right click the file -> delete)
Close 7zip and run "Publish" on the server in Eclipse
More info: https://jira.spring.io/browse/SPR-10494?focusedCommentId=94572&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-94572
Definitely, spring 3.2.x with eclipse and maven is not working; spring-web is not being published to WEB-INF/lib when launching the application from Google Eclipse Plugin.
Tried with Spring 3.2.1 and 3.2.2. It's only working for me using lower versions (now I'm using 3.1.4).

impossible add Icefaces 3 facet in Eclipse 3.7?

I am trying add Icefaces 3 facet but it is not work correctly, I have created a maven project (WTP=2.0) by maven command, the I have add JSF2,Java 1.6 and Javascript by Eclipse project facet, but when I try to add ICefaces 3 facet then Eclipse not working.
I add .XHTML extension in JSP editor and it work fine if I create a ICefaces project.
I don´t upload images, sorry, this is a link: http://www.flickr.com/photos/75492946#N02/6785053594/
In the image above, I press OK button and nothing happens, Icefaces 3 faces doesn´t add.
Otherwise, I download M2Eclipse and I have created a maven project, I followed the same steps above, and everything is fine until I try to add ICefaces 3 facet, with the same result for me.
I can write tag ui autocomplete bacause JSF2 nature add correctly, but I dont write autocomplete tags ace/ice
Finally, I could create a Icefaces project but this is not desired by me, because I need a Maven project within Icefaces 3 nature.
any suggestions?
Kinds regards.
==================================================================================
Finally!! I have resolved this problem. It is a very easy solution but I had overlooked. When You need to add Dynamic Web Module facet you must set Content directory: /src/main/webapp/
In this way the project preserver standard maven structure y then you could add JSF2 and Icefaces3 facet without problem.
Now, You can create *.xhtml file and autocomplete Icefaces,JSF2 and facelets tags.
Edit: The real conflict is the web.xml, it must be version=3.0, only in this way you can do the above steps.
ICefaces 3 releases note say: This release includes the Mojarra JSF 2.1.4 runtime libraries. Mojarra 2.1.4 introduces a hard depedency on Servlet 3.0 APIs, as a result, it cannot be used on older JEE5 application servers. Mojarra 2.1.3, or Apache MyFaces 2.1.6 should be used in on older JEE5 servers instead.
In my case I use Mojarra 2.1.3 and the web.mxl is version=2.5, but it conflict because ICefaces 3 eclipse facet somehow related Mojarra 2.14 and web.xml version=3.0
The final solution addition to the above is to user web.xml version=3.0 and libraries provided by Icefaces3 plugin.
If you start your project as an ICEFaces project, you can convert it to be a Maven project also after it is created.
Right click the project in your explorer
Select Configure > Convert to Maven project
This has worked for me in the past when I have needed a project to use Maven and other plugins at the same time.

Unable to publish web app: SpringSource Tool Suite problem?

I have an existing, fully functional Spring web application based on Spring 2.5.6 - developed using SpringSource Tool Suite 2.1.0.SR1.
Because I'd like to use REST I decided to upgrade to Spring 3.0.0.M4. After editing the dependencies in pom.xml and changing my code to reflect the API changes in Spring 3.0 I tried to publish my web app to a local server (SpringSource tc - a Tomcat derivate).
The result is an almost empty web app folder and therefore a non-functional app. The app's folder only contains WEB-INF/lib with all libraries required by the Maven dependencies.
After realising that something's broken, I created a new Spring MVC project (based on the default 2.5.6) and published it to the same server. No problems. I tried to adapt my project's files (.settings/*, .project, .classpath, .springBeans), but this didn't change anything.
I'm pretty lost right now. My guess is that STS doesn't handle 3.0 apps correctly. Any suggestions?
PS: I don't want to revert to 2.5 if it's not absolutely necessary. I don't need STS and tc so I don't have a problem using other tools, but it worked fine so far.
I run into this all the time using Eclipse Galileo and m2eclipse 0.9.8 and Tomcat with WTP. I think it is m2eclipse that is the culprit. The problem seems worse after switching from Ganymede. The work around is to run mvn to create the war and then copy the war contents from "target" to WTP's "wtpwebapps" directory. You can conveniently find this horribly long path by double clicking the server in the Servers view, and choosing "Open Launch Configuration" from there click on Arguments(?) tab I think and copy the catalina.home java property that is defined as an argument there.
The problem vanished with newer versions of STS. Additionally my development environment changed a bit since I posted this question, so I can't really tell what caused the problem.
For me, it looked like a weird hiccup inside STS.
Spring Tool Suite 2.1.0 claims partial support for Spring 3.0, though not for the REST features. According to the release, future releases will add full support. From the release statement:
Features
Support for milestones of Spring 3.0 including XML editing and validation, support for #Configuration and #Bean annotations
Future
Complete Spring 3.0 support including tools for developing RESTful web applications
Try deploying your app to embedded jetty. 'mvn jetty:run' with help you confirm if that there's nothing wrong with your build (that all the right manifests and deps are in place)