Class not found in project sources or resources GWT - java

I'm building GWT application with Maven. My application uses some custom UI forms instead of standard ones. I have files with custom UI forms, packed in .jar file.
My .ui.xml file has this:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:nc='custompackage.gwt.fields.client.widgets.reference'
>
...
<nc:UIReferenceField width="100%" text = "123" nc:field="rf"/>
...
My module .gwt.xml file inherits custom class:
...
<inherits name="custompackage.gwt.fields.Fields"/>
...
When I build Maven module I get:
Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.0:compile (default)
on project geographical-view-for-osp-gwt-2: GWT Module
com.netcracker.platform.ui.toolkit.gwt.i18n.i18n not found in project sources or resources.
I've looked into similar problem questions, but their resolution didn't help me at all. Can you help me?
P.S.: My module builds fine without custom fields.

I didnt add some dependencies to my .pom file. My inherited module depended on them and it didnt compile.

Related

Maven Plugin: accessing resources accross multiple modules

I'm currently writing a custom maven plugin for generating a XML file in a multi-module maven project.
My maven structure is pretty standard: one parent project and a module by project components in the parent project folder:
-- Parent
-- module A
-- module B
-- module C
I need to list, by module, a set of classes flagged by a custom annotation.
I already wrote a set of custom annotations and an annocation processor to create a XML file at compile time in the corresponding module output directory (${project.build.outputDirectory}) .
Now i need to merge each module XML into one file, but i don't know how to access each modules from within my maven plugin except having each path set as parameters (i don't like this method).
Any idea on how to do this ?
Does maven plugins can traverse project modules ?
Thank you in advance.
To get the list list of all projects you can use:
List<MavenProject> projectList = MavenSession.getProjectDependencyGraph().getSortedProjects()
If one of your goals is correctly executed you will get everything you need. Every MavenProject contains a getBaseDir() etc.
After some researches, it seems that MavenProject.getCollectedProjects() will return the list of projects beeing manipulated by a goal execution in a multi-module project.

Error inheriting a module in a mavenized GWT project

After adding this dependency in my pom.xml:
<dependency>
<groupId>com.eaio.uuid</groupId>
<artifactId>uuid</artifactId>
<version>3.2</version>
</dependency>
I get an error by jetty on the module load event:
no source code available for com.eaio.uuid; did you forget to inherit the module? unable to find com.client.myproject..`
What am I missing?
If you're using any of the classes in that artifact in your GWT compiled code, then the source code needs to be available, either packaged in the jar or as a source jar (remember that's another dependency).
You'll have to look for a .gwt.xml file in the jar, as this will be the name you need to inherit in your own GWT descriptor, eg. if the file is called com/eaio/UUID.gwt.xml you should
...
<inherits name="com.eaio.UUID" />
...
If one isn't available, just create your own with a simple <source path="..." /> and stick in the right package in your own project (still provided the source is actually available!)
Cheers,

Error while deploying custom widget in VAADIN 6

I created a custom VAADIN 6 widget. It worked fine. then i did the following
Create fresh VAADIN 6 project.
Add that jar to WEB-INF-> lib folder.
Add that jar to classpath.
inherit my custom widget in new projects widgetset file. like
<inherits name="com.vaadin.signature.signaturepad.SignaturePadWidgetset" />
In Web.xml i set widgetset.
Then i compile my widgetset.
This is the pattern i follow while creating the widget.
Now when i add this component in my application class it throws an error.
Widgetset does not contain implementation for com.vaadin.signature.signaturepad.SignaturePad. Check its #ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:
-Unrendered UIDL
-com.vaadin.signature.signaturepad.SignaturePad(NO CLIENT IMPLEMENTATION FOUND) id=PID2 clicks=0 message=Click here.
I created a jar file from my SignatureComponent package. Any help would be highly appreciated.

Maven Assembly: config files best practice

I have a multi-module maven project, including a seperate assembly-project. As i develop and run my application from eclipse (during development), i have specific configuration-files (e.g. log4j or other property-files) in my main-module (which contains the main-class). These files contain development-time-specific information. The assembly-project contains each of the config-files for production. The assembled product then should use these configs instead. This is my current setup:
MainModule/src/main/resources
+configA.properties
+log4j.properties
Module1/src/main/resources
+configB.properties
AssemblyProj/src/main/resources
+configA.properties
+configB.properties
+log4j.properties
And the generated project has this structure:
libs/
+MainModule.jar
+Module1.jar
configs/
+configA.properties
+configB.properties
+log4j.properties
the config-directory overlays the config-files in each *.jar because of the classpath, i.e.
java -cp configs/;libs/* My.Main.Class
Now the problem that i have, is that there are still all dev-configs included in each jar. Also i have kind of a bad feeling about using that overlay-classpath-method. Is there any practice on how to do this in a better manner?
Extract these resources into classifier-based dependencies for each of the mentioned modules. Then define <profiles/> that trigger their usage. In your assembly use the classifiers as necessary.

aspectj-maven-plugin multi module project

I'm trying to use aspectj-maven-plugin in a multi-module project and can't understand where aspects have to be placed. I want to crosscut in-module and between-modules calls. Where .aj files should be located?
This is what I did so far (structure of maven modules):
foo
foo-api
foo-impl
foo-aspects
.aj files are located in src/main/aspect. All sub-modules (except foo-aspects) are using aspectLibraries option of aspectj-maven-plugin, where they use aspects from foo-aspects.jar.
At the same time every sub-module has its own aspects in src/main/aspect. Works fine for me so far.

Categories