Official Community Forums
 
HomeHome  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  The Wiki  Website  github Project  

Share | 
 

 Eclipse and Server project

View previous topic View next topic Go down 
AuthorMessage
Guest
Guest



PostSubject: Eclipse and Server project   Tue 1 Jan - 4:52

I'm working with http://svn.code.sf.net/p/multiverse3d/ver20081125
and having a bit of trouble getting the server project to build in Eclipse.

Mars builds ok with build_mars.xml when isolated as \src\multiverse\mars

Setting up the Eclipse project just using \trunk\multiverse\build.xml
Added the external jars for the server project from \trunk\multiverse\other

I know I'm doing something wrong just looking for a clue... Smile
Probably missing a jar or something. Errors are mostly "cannot be resolved to a type"

Are there excludes that need to be added to build.xml? Some additional jar I've missed?

build.xml
Code:
<project name="multiverse" default="dist" basedir=".">
    <description>
        builds all multiverse server components
    </description>

  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="inject" location="inject"/>
  <property name="dist"  location="dist"/>
  <property name="bin" location="bin"/>
  <property name="dist-external"  location="dist-external"/>
  <property name="build.fork"  value="yes"/>

  <path id="build.classpath">
    <pathelement path="other/rhino1_5R5/js.jar"/>
    <pathelement path="other/mysql-jdbc/mysql-connector-java-3.0.14-production-bin.jar"/>
    <pathelement path="other/java-getopt-1.0.11.jar"/>
    <pathelement path="other/jython.jar"/>
    <pathelement path="other/log4j-1.2.14.jar"/>
    <pathelement path="other/bcel-5.2.jar"/>
    <pathelement path="other/servlet-api.jar"/>
    <pathelement path="other/jsp-api.jar"/>
  </path>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${inject}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${dist-external}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}"
          destdir="${build}"
          excludes="multiverse/webapps/**,multiverse/testclient/**,multiverse/**/eventhandlers/**,**/QuestStatusChanged.java"
          listfiles="yes"
     compiler="modern"
     fork="${build.fork}"
     classpathref="build.classpath"
          debug="true">
<!--      <compilerarg value="-Xlint"/> -->
    </javac>
    <!-- <rmic classname="multiverse.server.engine.GroupManagerImpl" base="${build}"/> -->
  </target>

  <target name="testclient" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}"
          destdir="${build}"
          excludes="multiverse/webapps/**"
          listfiles="yes"
     compiler="modern"
     fork="${build.fork}"
     classpathref="build.classpath"
          debug="false">
      <compilerarg value=""/>
    </javac>
  </target>

  <target name="webapps" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}/multiverse/webapps"
          destdir="${build}"
     fork="${build.fork}"
          debug="false"/>
  </target>

  <target name="buildjars" depends="compile"
        description="build jar files" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>
    <mkdir dir="${dist-external}/multiverse/dist/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<!--
    <jar jarfile="${dist}/lib/multiverse.jar"
        basedir="${build}"/>
-->

    <jar destfile="${dist}/lib/multiverse.jar"
      basedir="${build}/"
      includes="multiverse/**"
      excludes="multiverse/mars/**,multiverse/example/**"
    />

    <jar destfile="${dist}/lib/mars.jar"
      basedir="${build}/"
      includes="multiverse/mars/**"
    />
    <jar destfile="${dist-external}/multiverse/dist/lib/multiverse.jar"
      basedir="${build}/"
      includes="multiverse/**"
      excludes="multiverse/mars/**,multiverse/example/**,multiverse/server/engine/JukeboxWebEngine.class,multiverse/server/plugins/JukeboxWebPlugin.class,multiverse/server/engine/JukeboxWebEngineThread.class,multiverse/server/engine/MasterDatabase*.class,multiverse/server/engine/MasterServer*.class"
    />

    <jar destfile="${dist-external}/multiverse/dist/lib/mars.jar"
      basedir="${build}/"
      includes="multiverse/mars/**"
    />

    <uptodate property="dont_need_inject" targetfile="${dist}/lib/injected.jar">
      <srcfiles dir  = "${dist}/lib" includes="m*.jar" />
    </uptodate>

  </target>
  <target name="dist" depends="buildjars" unless="dont_need_inject"
        description="generate the distribution" >
    <exec dir="${bin}" os="Windows XP" executable="cmd">
      <arg value="/c"/>
      <arg value="performinjection.bat"/>
    </exec>
    <exec dir="${bin}" os="Windows Vista" executable="cmd">
      <arg value="/c"/>
      <arg value="performinjection.bat"/>
    </exec>
    <exec dir="${bin}" os="Linux" executable="bash">
      <arg value="performinjection.sh"/>
    </exec>

    <jar destfile="${dist}/lib/injected.jar"
      basedir="${inject}/"
      includes="**"
    />

    <jar destfile="${dist-external}/multiverse/dist/lib/injected.jar"
      basedir="${inject}/"
      includes="**"
    />
  </target>

  <target name="tar">
    <tar destfile="server.tgz" compression="gzip">
      <tarfileset dir=".." mode="755"
        includes="multiverse/bin/*.sh,multiverse/bin/*.py,multiverse/bin/mvm,multiverse/bin/check_mvplugin,multiverse/bin/service_script"
         excludes="multiverse/bin/keygen.sh,multiverse/bin/master.sh,multiverse/bin/create_account.sh,multiverse/bin/create_character.sh,multiverse/bin/create_default_chars.sh,multiverse/bin/clear_obj_store.sh,multiverse/bin/old-multiverse.sh,multiverse/bin/master_server.py,multiverse/bin/shell.sh,multiverse/bin/domain.sh"
      />
      <tarfileset dir=".." mode="644"
        includes="multiverse/README.txt,multiverse/build_mars.xml,multiverse/licenses/**,multiverse/bin/**,multiverse/install/**,multiverse/config/sampleworld/**,multiverse/config/common/**,multiverse/config/mv_fantasy/**,multiverse/other/**,multiverse/src/multiverse/mars/**/*.java"
        excludes="multiverse/bin/*.sh,multiverse/bin/*.py,multiverse/bin/mvm,multiverse/bin/check_mvplugin,multiverse/bin/service_script,multiverse/bin/master.sql,multiverse/bin/save.js,multiverse/bin/reset.js,multiverse/bin/sample_bashrc,multiverse/bin/cachedir/**,multiverse/config/mv_social/**,multiverse/other/mysql-jdbc/**,multiverse/**/*~,multiverse/**/*.pid,multiverse/bin/run/**"
      />
      <tarfileset dir="dist-external" mode="644"
        includes="multiverse/dist/**"
      />
    </tar>
  </target>

  <target name="zip">
    <zip destfile="server.zip">
      <zipfileset dir=".." filemode="755"
        includes="multiverse/bin/*.sh,multiverse/bin/*.py,multiverse/bin/mvm,multiverse/bin/check_mvplugin,multiverse/bin/service_script"
         excludes="multiverse/bin/keygen.sh,multiverse/bin/master.sh,multiverse/bin/create_account.sh,multiverse/bin/create_character.sh,multiverse/bin/create_default_chars.sh,multiverse/bin/clear_obj_store.sh,multiverse/bin/old-multiverse.sh,multiverse/bin/master_server.py,multiverse/bin/shell.sh,multiverse/bin/domain.sh"
      />
      <zipfileset dir=".." filemode="644"
        includes="multiverse/README.txt,multiverse/build_mars.xml,multiverse/licenses/**,multiverse/bin/**,multiverse/install/**,multiverse/config/sampleworld/**,multiverse/config/common/**,multiverse/config/mv_fantasy/**,multiverse/other/**,multiverse/src/multiverse/mars/**/*.java"
        excludes="multiverse/bin/*.sh,multiverse/bin/*.py,multiverse/bin/mvm,multiverse/bin/check_mvplugin,multiverse/bin/service_script,multiverse/bin/master.sql,multiverse/bin/save.js,multiverse/bin/reset.js,multiverse/bin/sample_bashrc,multiverse/bin/cachedir/**,multiverse/config/mv_social/**,multiverse/other/mysql-jdbc/**,multiverse/**/*~,multiverse/**/*.pid,multiverse/bin/run/**"
      />
      <zipfileset dir="dist-external" filemode="644"
        includes="multiverse/dist/**"
      />
    </zip>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${inject}"/>
    <delete dir="${dist}"/>
    <delete dir="${dist-external}"/>
  </target>

  <target name="tags">
    <delete file="TAGS"/>
    <apply executable="etags">
      <arg value="-a"/>
      <arg value="-oTAGS"/>
      <arg value="-ljava"/>
      <fileset dir="${src}" casesensitive="yes">
        <include name="**/*.java"/>
      </fileset>
    </apply>
  </target>
</project>

Folder setup is \trunk\multiverse\ from http://svn.code.sf.net/p/multiverse3d/ver20081125





Thanks in advance!


Cheers
Back to top Go down
CobaltBlues
Moderator
Moderator
avatar

Posts : 202
Join date : 2011-11-21
Location : Chicago Land

PostSubject: Re: Eclipse and Server project   Tue 1 Jan - 5:30

It took me awhile to get everything just right for a successful compile of the Java server. I'll have to take a look at my setup and let you know what I did.
Back to top Go down
http://www.multiversemmo.com
oldschool
Experienced Newbie
Experienced Newbie
avatar

Posts : 26
Join date : 2012-12-27
Location : Canada

PostSubject: Re: Eclipse and Server project   Thu 3 Jan - 8:29

Hey Koron,

I just spent last night doing this let me give you a break down.

I used JDK 7, so this means I had to port some of the code as it seemed to be using OpenJDK.
I have not tried to use OpenJDK on eclipse before, so I just ported the code.

I actually have it all saved as a patch I could send you once I get home.

But basically a few libraries were required to be added.

1.) I updated to the latest python, this triggered a couple small changes
2.) getopt lib, I had to get also, I believe I downgraded this library by one version
3.) jvmstat, I did an upgrade here, but it didn't seem to matter
4.) I unloaded the client network test code, it looks out of date and will need some more work


Honestly I took better notes than I can recollect, I will update this post when I get home add the patch, also I think I am missing one more library I had to get.



Back to top Go down
Guest
Guest



PostSubject: Appreciate the help   Thu 3 Jan - 10:27

Really appreciate the help! cheers

Been quite a while since I've worked with Eclipse or Java, played with J2ME a long time ago.


We'll have to add this stuff to the wiki Very Happy


Cheers


Back to top Go down
oldschool
Experienced Newbie
Experienced Newbie
avatar

Posts : 26
Join date : 2012-12-27
Location : Canada

PostSubject: Re: Eclipse and Server project   Thu 3 Jan - 11:16

Yea, would be nice to understand what the direction of choice is regarding which JDK to support.

If we can nail that down, we can configure the code for that build in the repository, and stuff should be turn key.

Aside from which JDK to use, having the dependent libraries listed would be also handy.

I would be happy to get this patch into head if we want to roll on JDK 7.

Back to top Go down
oldschool
Experienced Newbie
Experienced Newbie
avatar

Posts : 26
Join date : 2012-12-27
Location : Canada

PostSubject: Re: Eclipse and Server project   Thu 3 Jan - 13:55

Ok, I have the patch, realize I didn't spent a ton of time on it, but overall I am confident of all fixes but one.

It seems we have lost the ability to call a method and I modified the test.
Basically, we have lost the ability to call: JavaClass.isEnum() in the MarshallingRuntime.java

Code:

                        JavaClass fieldClass = javaClassOrNull(name);
                        if (fieldClass.isClass() != true) { // fieldClass.isEnum()) {
                           // TODO: MAJOR HACK ABOVE
                            Log.error("For class '" + className + "', field '" + f.getName() + "' is an enum, and enums are not supported");
                            someMissing = true;
                        }

But, It likes it, I have replaced both mars.java and multiverse.java with the output of the build process.
server runs with no issue, you can note the replaced java files being acknowledged.

As far as how the project was configured I followed the wiki, up until things didn't work out, as the wiki indicates at the bottom portion.

From this patch, all code is repaired except the testclient code.

I then simply export the jar file placed it into server dist folder manually for testing.
I did at this point copy it to replace both files, as all the code is setup here.

What I needed next was the appropriate java dependencies, as mentioned I modified some of the versions.
This code can easily be pulled from the patch as overall the changes were very minimal.

Dependencies:
Code:

jython-2.5.3.jar
java-getopt-1.0.13.jar
jvmstat-2.0_b11.zip
log4j-1.2.13.jar

Sorry for no hotlinks there, shouldn't be hard to locate.

So not sure how to post the patch, was thinking just dump it but.

Here is a pastebin link: Multiverse repo patch 010213

Fairly certain I got everything in order here, I plan to make a wiki account at some point, working on a ShopKeeper I would like to perhaps post bounce


Edit:

Also, to add my disclaimer I am not a Java pro Razz I am a c++ guy.

But, if you chose to simply add the existing libraries from the ../other/*.java to the project things will be much easier, and perhaps 100%
you might not need to patch any code at all.

so to add libs in eclipse, its project/properties/Java Build Path/Libraries add external JARs...
Back to top Go down
Guest
Guest



PostSubject: Eclipse and Server project   Thu 3 Jan - 23:48

Time to get to work... *grabs coffee*


Will post when I get it working.


Thanks oldschool! cheers



EDIT: I did conveniently forget to mention I am using jdk6.
Also forgot to mention I hadn't resolved the missing imports Embarassed

Stop laughing! Laughing

I'll try to resolve all my noob issues before I post again.


Cheers

Back to top Go down
oldschool
Experienced Newbie
Experienced Newbie
avatar

Posts : 26
Join date : 2012-12-27
Location : Canada

PostSubject: Re: Eclipse and Server project   Fri 4 Jan - 3:57

Hah, awesome stuff bud.

I am pretty much a java noob also, only a few months under my belt.
mostly been working on an Android app, so that is my experience.

But yea, I did not actually find the libs until well into updating the code to suit the bits I could find online.
hah, damn rookies huh? Razz

Back to top Go down
Sponsored content




PostSubject: Re: Eclipse and Server project   

Back to top Go down
 
Eclipse and Server project
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» .^f2F-.Swemmei Recruting in server 1
» Lag playing in Taiwan server from Shanghai
» Proxy Server Taiwan: How To.
» WoW "Development" Server
» Omnos (( Maybe another name depending on server)) Sunbearer

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Server Scripting and Development-
Jump to: