Multiple source folders for Super Dev Mode - gwt

Problem
Is there any way Codeserver accept more than one dir in the -src flag?
Details
I'm trying to separate my source code into folders like this:
src
widgets
utility
main
I got the regular dev mode to compile my code via the following *.gwt.xml files:
src/MyProject.gwt.xml
<module>
<inherits name='com.google.gwt.user.User' />
<inherits name="com.my.project.Widget"/>
<entry-point class="com.my.project.Test" />
</module>
widgets/Widgets.gwt.xml
<module>
<inherits name='com.google.gwt.user.User' />
<inherits name="com.my.project.Widgets"/>
</module>
But every time I try to run in the Codeserver (SuperDevMode), it will say it can't find classes in com.my.project.Widgets package.
I'm running SuperDevMode using the following arguments:
-src src/ com.my.Project.MyProject
But I'm guessing I need something like:
-src src/ com.my.Project.MyProject widgets/ com.my.Project.Widgets
FYI
I know you can organize the classes using packages but I would prefer to have them in separate source folders, so later on I can easily repackage them into separate jars.
Update
Just tried adding the [module]:
-src src/ com.my.Project.MyProject com.my.Project.Widgets
Didn't work :(

Just pass -src as many times as you need it:
-src src/ -src widgets/
The modules comes last on the command line, and are looked up in all source folders and the classpath:
-src src/ -src widgets/ com.my.Project.MyProject
Note that only modules with an <entry-point> (or inheriting a module that has an <entry-point>) can be passed that way on the command line; without entry-point the module is only a "library" to be inherited by other modules, not an "application".
Note, you could also just add all your source folders to the classpath, instead of using -src.

Related

How can I include a file with a NuGet package, and then add that file to a project when the NuGet package is installed?

I have a project that includes 2 files:
ThisProject.config.example
ThisProject.xsd
This project is packaged as a Nuget package, which is then added to other projects. When this happens I would like these files copied into the projects. The user then copies ThisProject.config.example to ThisProject.config and edits that file.
I understand that within a .nuspec file there are two ways to include files. These are:
<files>
<file src="ThisProject.config.example" target="ThisProject.config.example" />
<file src="ThisProject.xsd" target="ThisProject.xsd"/>
</files>
Doing this, I see that when I install the package into the /packages folder that the files have been copied over. Which is good. However, then it would seem that I need to use a .ps script to add them to the project that the nuget package is installed to?
I haven't tried this yet, but according to THIS link, there are three scripts that can be incorporated into NuGet packages:
Init.ps1
Install.ps1
Uninstall.ps1
But No. 2 and 3 are obsolete from VS 2017 onwards? The link that is provided for explanation points to information on MSBuild. But there is no explicit information on flatfile types so far as I can see.
Then. Supposedly there is a <contentFiles> tag. But according to THIS post (NuGet blog) only works when a package is added to certain project types. And does not work with package.config files...
What is the expected way of adding a file to a project from a NuGet package??
I have found that if you put files within certain folder structures that they are implicitly added to the package and also added to the project root directtory. However I still have not found a way to add the files as items in the project itself. this is an example of the .nuspec file.
<?xml version="1.0"?>
<package >
<metadata>
...
<tags>some tags</tags>
<contentFiles>
<files include="**/*.*" buildAction="None" copyToOutput="true" flatten="true" />
</contentFiles>
</metadata>
<files>
<file src="contentFiles\any\any\config\name.example" target="content\name.example" />
<file src="contentFiles\any\any\config\name.xsd" target="content\name.xsd"/>
</files>
</package>
The MS docs mention it is useful to define both files and contentFiles. I think the requirement is that the nuget package has a folder content, in which files are transferred to the project directory

GWT Main.gwt.xml file

I have a gwt project with the following directories:
-com.project
-com.project.client
-com.project.shared
-com.project.server
The gwt.xml config file is located in the com.project directory. What value should be in the
<source> tag for path?
Do you mean the tag for source with attribute path in the gwt.xml file? If that's the case, you use those paths for the translatable code (i.e., the code you want compiled from Java to JavaScript). Typically it's just the client and shared code that you want the GWT compiler to handle so you would set the following:
<source path='client' />
<source path='shared' />
If you were referring to another tag, please forgive me. :)

GWT Compiler cannot find Collect.gwt.xml, but I have Guava as a dependency

I'm moving over to a new computer, and in the processing I'm creating new Intellij 12 projects from my git source.
I have a gwt module file containing the following:
<!-- Other module inherits -->
<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" />
<inherits name="com.bdl.message.Message" />
<inherits name="com.bdl.universal.Universal" />
<inherits name="com.bdl.appengine.AppEngine" />
<inherits name="com.bdl.gwt.BdlGwt" />
<inherits name="com.google.gwt.inject.Inject"/>
The com.bdl.* entries are from another library I've written and I have their jar files (and sources) in the module dependencies. I can confirm that removing those dependencies causes the corresponding inherits nameto turn red, indicating an error.
I also have as a dependency, a global library Guava (GWT) which contains:
classes:
guava-14.0-rc2.jar
sources:
guava-14.0-rc2-sources.jar
guava-gwt-14.0-rc2.jar
javadoc
guava-14.0-rc2-javadoc.jar
But despite this, the inherits for Collect and Base are red and the GWT compiler fails, saying it can't find Collect.gwt.xml.
On my old system I have an Intellij 11 project, which is set up the same way (there must be some difference somewhere, but I've been looking for hours to find it and can't)
That also has the same library as a dependency, and the inherits lines in my app's module are still red, but the GWT compiler succeeds, finding the Collect.gwt.xml right where it should be, at:
jar:file:/[path-to-guava]/guava-gwt-14.0-rc2.jar!/com/google/common/collect/Collect.gwt.xml
There must be something simple and stupid that I'm missing, but I can't find it.
You probably need to add guava-gwt-14.0-rc2.jar to your dependencies. Notice that the name has -gwt- embedded in it and you said that you have just these as dependencies:guava-14.0-rc2.jar sources: guava-14.0-rc2-sources.jar guava-gwt-14.0-rc2.jar javadoc guava-14.0-rc2-javadoc.jar
You can check that the jar is the appropriate one because when you open it (it is just a zip file) you should see the Collect.gwt.xml file somwhere within.

Adding external jar in GWT

I have a jar file with source code packed.
i inserted the jar in war/WEB-INF/lib/xxx.jar Add to build path
but when i run the project i got an error
Edited Added gwt.xml
<module rename-to='bookmanagementsystem'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<inherits name='com.example.Book'></inherits>
<entry-point class='com.example.Book.client.Index'/>
</module>
Edited
I solved
Plugin failed to connect to Development Mode server at 127.0.0.1:9997
Now i got a problem
Loading inherited module 'com.example.book'
[ERROR] Unable to find 'com/example/book.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 6: Unexpected exception while processing element 'inherits'
If you want to include external jar to GWT then make sure you did the following
check the jar has .gwt.xml file and it must specify the source.
add it to lib folder
configure build path and add jar to libraries
select the jar from Order and Export
inherits this module in your .gwt.xml file
Eg. if you have a package in jar named "sample.source" and your .gwt.xml file in jar is "Source.gwt.xml" and this .gwt.xml file in "sample" folder and classes or entities in "source" folder
Then your current project must inherits it. ie it must have the following tag
<inherits name='sample.Source'/>
Eg :
Sorce.gwt.xml in jar file
<module>
<source path="">
<include name="**/MyEntity.java"/>
</source>
</module>
For reference :http://jonathan.lalou.free.fr/?p=1077
GWT is not supporting serialization in client side so try to use RPC and use these classes from jar in server or you just copy the packages of jar and add to src of gwt project.
OR
I solved the problem the jar files must have java source code along with class files or pack java source code into jar and use.

Adding jars to GWT project

this may be a stupid question but after 30minutes of Googleing, I still havent found an answer..
I want to build the example program "gwt-beans-binding" ( http://code.google.com/p/gwt-beans-binding/.
I download the *jar file and copied it into the the lib folder and added it to Properties-->Java Build Path -- >Libaries --> Add JARs.
When I'm build the project, I'm geting "java.lang.ClassNotFoundException"s...
What am I missing (do I have to write something in the *.gwt.xml?
For building inside Eclipse it should be enough with adding the library jar to the Libraries. But for GWT compiling (or executing inside Developer Mode) your module file (*.gwt.xml) has to point to the library module file. The library module file will say where the GWT source code is located.
<!-- this will declare where the source code is for the library GWT classes -->
<inherits name='org.gwt.beansbinding.Main' />
<!-- OR THIS... I don't really know -->
<inherits name='org.gwt.beansbinding.BeansBinding' />
The GWT compiler needs the sources to comile Java code to JavaScript. So you have to add the source folder to the class path too.
Can you give us the full stacktrace, what class is missing?