Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [libgdx]How to import external Eclipse projects/ JARs into the GWT-HTML backend?  (Read 1234 times)
0 Members and 1 Guest are viewing this topic.
Offline JFixby
« Posted 2015-01-28 18:36:54 »

Hello

Sorry if the question was answered already.

I'm having a problem running my project when depending on external JARs and other Eclipse projects.
The desktop version works fine. However the GWT/HTML projects seems unable to see dependencies
I can't run the html version - it crashes with this message like:
1  
2  
3  
4  
[ERROR] Line 6: The import com.jfixby.red cannot be resolved
[ERROR] Line 7: The import com.jfixby.red cannot be resolved
[ERROR] Line 8: The import com.jfixby.red cannot be resolved
...


while the referred lines are:
1  
2  
3  
4  
import com.jfixby.red.mp.TheGame; // inside other project
import com.jfixby.red.triplane.fokker.starter.gwt.FokkerStarterGwt; // inside other project
import com.jfixby.red.triplane.fokker.starter.gwt.FokkerStarterGwtConfig; // inside other project
...


Here is what I did:

1) I removed all required my (external) dependencies from the gradle-produced projects build path. So it shows red ("unable to compile") flags.
2) I compiled all my dependencies (eclipse projects) to *.JAR files
3) I edited the build.gradle file in the root project of the gradle-produced projects by adding the following text:
1  
2  
3  
4  
        compile fileTree(dir: 'D:/[DATA]/[DEV]/libs/red-triplane', include: '*.jar')
        compile fileTree(dir: 'D:/[DATA]/[DEV]/libs/red-triplane/examples', include: '*.jar')
        compile fileTree(dir: 'D:/[DATA]/[DEV]/libs/apache-commons', include: '*.jar')
        compile fileTree(dir: 'D:/[DATA]/[DEV]/libs/spine', include: '*.jar')

in each of these sections: html and desktop

4) Then I clicked Gradle->Refresh All and it removed all the red flags from the (1). Also it added my jars into the Gradle Dependencies section of the gradle-produced projects build pathes.

Now it all perfectly works for the Desktop gradle-produced backend.

However it doesn't work for the HTML backend. Still the same problems as described above.

Assuming I need source code of the jar to compile the GWT. (Not sure that is correct assumption)

I did the following:

1) I unpacked the first jar apache-commons-io.jar into the newly created eclipse project. Now I have the jar's source code.

2) I created ApacheCommonsIO.gwt.xml and placed it near the GdxDefinition.gwt.xml and GdxDefinitionSuperdev.gwt.xml files:
1  
2  
3  
4  
<?xml version="1.0" encoding="UTF-8"?>
<module>
   <source path="/org/apache/commons/codec" />
</module>


3) Then I add the following line: <inherits name='%package_name%.ApacheCommonsIO' /> into the GdxDefinition.gwt.xml and GdxDefinitionSuperdev.gwt.xml
so it looks like
1  
2  
3  
4  
5  
6  
7  
8  
9  
<module rename-to="html">
   <inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
   <inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' />
   <inherits name='com.jfixby.redtriplane.fokker.gradle.GdxDefinition' />
...
   <inherits name='com.jfixby.redtriplane.fokker.gradle.ApacheCommonsIO' />
...

</module>


4) Then I edited ApacheCommonsIO.gwt.xml and explicitly wrote the source folder location:
1  
2  
3  
4  
<?xml version="1.0" encoding="UTF-8"?>
<module>
   <source path="D:/[DATA]/[DEV]/commons-io-2.4/src/org/apache/commons/io" />
</module>


I did the same steps for all other JARs. It passed successfully compiling all steps until reaching the same result "The import cannot be resolved".

I have no ideas what else I can do.

So... again: how to import external Eclipse projects/JARs into the GWT-HTML backend?

my dev log: http://jfix.by/
Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (110 views)
2017-09-30 02:57:34

theagentd (136 views)
2017-09-26 18:23:31

cybrmynd (245 views)
2017-08-02 12:28:51

cybrmynd (241 views)
2017-08-02 12:19:43

cybrmynd (240 views)
2017-08-02 12:18:09

Sralse (254 views)
2017-07-25 17:13:48

Archive (864 views)
2017-04-27 17:45:51

buddyBro (1008 views)
2017-04-05 03:38:00

CopyableCougar4 (1568 views)
2017-03-24 15:39:42

theagentd (1373 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!