I had a GWT app, and I wanted to automate its build and deploy system, since I do it manually. But I did not find a way how to build the app from command line, so it can than be automated. I had to click the Google button, then compile GWT project and then click Compile.
I found out that it is possible to create a GWT maven project and that it should then be possible to compile my project from commandline with mvn gwt:compile.
So I created a new project using this plugin. Copied my sources from the old project to this new one.
Now the structure is like this:
/src
---/main
------/java -> here are all my sources including my Project.gwt.xml file.
------/webapp
---/test
pom.xml
Now I have 2 problems.
1. I thought that I add dependencies to the pom.xml, and then when I build the app, it will create the jars and I can use those libraries in my GWT app. I guess 'mvn clean install' should do this, but so far I'm getting compile errors.
2. I did not get mvn clean install to work, so I added all the jars manually again... And then yes! I was able to build the app using the plugin GWT button! So I was thinking that now I can use 'mvn gwt:compile', but it fails with:
Unable to find: "com/company/project/Project.gwt.xml" on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
EDIT:
So I fixed my <moduleName> element in pom.xml, so now it finds the Project.gwt.xml. I'm trying to run:
mvn clean install gwt:compile
But I am getting compile errors. I think, it tries to build my project without the actual dependecies because it tells few classes don't exist, but those classes are part of an external library. (specifically this one). But I have it in the dependencies, so I don't know what more to do.
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<version>3.0.0</version>
</dependency>
Also in eclipse I had to manually add the jars to my project, so that was why it worked there and not in the command line. So I would also like to ask how to tell eclipse to get those jars and include them to the project, because otherwise eclipse is missing those dependencies and displays many errors.
First I had a problem with <moduleName> in my pom.xml was missing com.company.project prefix before the actual module name.
Then I had errors in my Java files, which was caused by RELEASE version of GWT-OpenLayers 3 library missing some of the features that I previously used by building the JAR from the GitHub repository.
Related
I am quite new to Maven.
I have a Maven Project.
When I create execute using mvn clean -e install it creates executable jar (commounutil.jar) for my project in target folder.
Not I have another project (project2) in Eclipse which is not a Maven based project.
Project2 uses features and classes from commounutil.jar.
If I manually add my executable jar commounutil.jar in eclipse using Java build path/add external jar.
But even after adding this jar there are some errors in my project which are related to log4j.
Now when I build commounutil the dependency for log4j was already added.
Still it is giving compile time error.
Could you please tell me where I am going wrong?
Add log4j in your Eclipse classpath. Commonutils.jar,if it follows modularity promoted by maven,provides only common utils class and do not provide class related to its dependencies.
Maybe you should consider to update your second project to a maven project.
I have multi module maven project, that is build with gwt as a main web framework. Here is github repo.
Everythink works as it should as I supose. I haven't got anything wrong.
Unfortunatelly the problems occur when I try to import this project into eclipse (as maven project). I can not compile this project (using RMB on project in Package Explorer -> Google -> GWT Compile).
I am getting an error:
Loading inherited module 'src.main.resources.pl.derp.parent'
Loading inherited module 'pl.derp.shared'
[ERROR] Unable to find 'pl/derp/shared.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
When I tried to RMB on Project name in Package Explorer -> Run -> Run as Web application (GWT Super Dev Mode)
I've got:
Working directory does not exist: /home/danielo/eclipseGwt/gwt_2.7.0_maven_eclipse/web/src/main/webapp
I've added modules to build path.
I've followed this instruction
I think, that I've done everything to make it work, but still can make it work.
I think the problem is in packages name, and the way they are treated by maven and eclipse. They are treated in diferent ways.
Maven easily find every class (f.e.: package pl.derp.web;) needed and compile. The eclipse is trying to find them by f.e.: src.main.java.pl.derp.web but can't found it.
Really I don't know how to resolve this issue?
I am not sure witch package name patter is better (src.main.java.pl.derp.server or pl.derp.server)- for me the shorter is better.
To run this project in maven (it is well described here):
mvn clean install
mvn tomcat7:run-war-only
and in second shell:
mvn gwt:run -pl web
And in Eclipse I think I am running built in Jetty server
Please give me some help.
You apparently have a single Eclipse project, with server, shared, and web declared as source directories. When using M2Eclipse, you should have 3 projects, each with their src/{main,test}/{java,resources} declared as source directories. At a minimum, without M2Eclipse, the source directories must be the src/{main,test}/{java,resources}, whether you have 1 or 3 projects.
This is why Eclipse looks for src.main.java.pl.derp.server instead of pl.derp.server, and why GWT fails too (classpath is similarly wrong).
I have a non-maven app engine project. I need to include the following library/project into it: https://github.com/UltimaPhoenix/luceneappengine. Without using maven at all, how do I make this work? I need step by step details. I have been trying and my code will not even compile. I am using eclipse.
Looking at the pom.xml I have figured that I need to download luceneappengine, which I did at http://search.maven.org/#search%7Cga%7C1%7Cluceneappengine. Do I need any other jars?
First of all, download Maven to be able to build the project. After that, just use "mvn install" to produce the *.jar of luceneappengine (the result will be stored in the "target" folder of the project). However, it will probably need some extra dependencies. To obtain them, use "mvn dependency:copy-dependencies -DoutputDirectory=$TARGET_DIRECTORY". This command will download all the required jars into the specified $TARGET_DIRECTORY.
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.
I've been trying to add a custom .jar (ftp://ftp.ncbi.nlm.nih.gov/pub/eutils/soap/v2.0/java/axis2_1.5.2_jdk_6.0.12/eutils_axis2.jar) to a project that doesn't have a central corporate maven repository and that instead will have the custom JARs checked into SCM in the project directory tree. I was following this post to make it happen: Maven: add a dependency to a jar by relative path (awesome post btw).
What I did was:
Add local repository to pom.xml
install the file into the local repository
Add dependency to pom.xml
Based on what I see in m2eclipse, the library has been successfully recognized by Maven and added to the dependency list (or it'd be called ? : ? or something similar)
The problem is that Eclipse still doesn't see the referenced lib, so this still fails:
import gov.nih.nlm.ncbi.www.soap.eutils.*;
Pardon my maven newbiness, but what are changes / next steps I need to make to get to:
Have Eclipse see the library so that autocomplete works (and the import can be resolved)
Be able to compile the project
Be able to execute the jar produced by mvn package?
Thanks!
If you see the JAR under "Maven Dependencies" in your project, Eclipse should be able to see and use it. If it's not there, then m2eclipse wasn't able to resolve the dependency properly.
If it is missing, m2eclipse was unable to download the dependency from your local repository for some reason. Check the Maven 2 Console for errors and the Problem View.
Lastly, the JAR itself might be corrupt. Maven doesn't check for that, it simply adds the file to the classpath. If Eclipse can't open the JAR, you can also get the errors you mentioned.