*
The moose likes JForum and the fly likes Using JForum .jars in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Using JForum .jars in Eclipse" Watch "Using JForum .jars in Eclipse" New topic
Author

Using JForum .jars in Eclipse

robert crowther
Ranch Hand

Joined: Oct 19, 2013
Posts: 41
    
  10
On using binary/.jars,

Cons
  • Code updates will still need work. JForum and JForum2 have gone to some lengths to make this easy, but it is still unlikely that .jar replacement will be a seamless update.

  • Pros
  • Easy, yet configurable. JForum (and JForum2) are built like a small CMS. If templating and configuration are all that is needed, this is the way to go.

  • So, even if downloads will bundle as a .war for deployment, how can this structure be imported to an IDE like Eclipse?


    Steps

    Getting the code
    - JForum2
    Is available as a .war,
    https://code.google.com/p/jforum2/downloads/list

    If the .war is extracted, there is no source, but a jforum-x.x.x.jar will be found in,
    WEB-INF/lib. As far as I can see, there are no build facilities.

    - JForum
    Is available as a .zip,
    http://jforum.net/download.jsp

    If .zip is extracted, there is no source, the classes are precompiled into,
    WEB-INF/classes/net/jforum. There is a Maven .pom file in /META-INF/maven/net.jforum/jforum/pom.xml.


    Import into Eclipse
    - JForum2
    Is a .war. In Eclipse,
    File > import > Web > War File > Next ...
    Ignore import "WAR Import: Web libraries". These are all stock for JForum2, and should work as expected.

    - JForum
    None of the Eclipse "File > Import" options will work. The handy looking "Install" imports seem to be for importing code from existing projects. Likewise, in the "General" section, the options "Archive File" and "File System".

    However, the project can be imported using a stock Java approach by making a .war (which will work because the folders are configured to be a .war),

    cd into the folder then make a .war,
    jar -cvf jforum-x.x.x.war *

    In Eclipse,
    File > import > Web > War File > Next ...

    Browse for the .war, name the project (optional), then "Finish"

    Adding Maven
    If Maven control is desired (for adding additional functionality in an agreeable way), well, what you have depends on the version of JForum used. JForum2 has a .pom file, deep inside folders, META-INF/maven/net.jforum/jforum. JForum 2.1.9 has nothing.

    The JForum2 .pom file is not, as far as I know, reusable. It is a relic from when the JForum2 structure was built. For example, all the filepaths are wrong, referring to non-existent source folders (this wouldn't be the case for a source download, which would rely on the .pom). And JForum2 can not be imported as a Maven project, because the support folder structure is required.

    In either case, as far as I know, if the binary project would be helped by Maven, then another .pom is needed. Fortunately, Eclipse can fix this. In the left panel,

    Right click on the project then,
    Configure > Convert to Maven Project

    Unless any modifications are needed immediately, agree to the stock setup. The result will be a .pom file, sited in the top level of the project.

    To use this, Eclipse needs a run configuration,
    Run > Run As > Maven Build

    Then set,
    Goal = "package"
    And tick "Skip tests".

    Now, that run configuration can be applied and run, either immediately or by selecting from the menus under "Run > Run As".

    This Maven build will only cover additions to JForum, not the original or a full build, but that should be enough.
    Jeanne Boyarsky
    internet detective
    Marshal

    Joined: May 26, 2003
    Posts: 30138
        
    150

    JForum has nothing.

    I think you are missing a version # here.


    [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
    Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
    robert crowther
    Ranch Hand

    Joined: Oct 19, 2013
    Posts: 41
        
      10
    Yes, I should have done. The reference is to JForum, as available at the time of writing, from the original site - 2.1.9. Other versions differ, and it's clear that JForum2 has adapted slightly different internal structure and publishing for the code resource.
    Jeanne Boyarsky
    internet detective
    Marshal

    Joined: May 26, 2003
    Posts: 30138
        
    150

    robert crowther wrote:Yes, I should have done. The reference is to JForum, as available at the time of writing, from the original site - 2.1.9. Other versions differ, and it's clear that JForum2 has adapted slightly different internal structure and publishing for the code resource.

    Ah ok. I've edited that into your post since it was confusing without.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Using JForum .jars in Eclipse
     
    Similar Threads
    Import Google JForum2 source to Eclipse
    Using Own Directory Structure in Maven
    The canonical source-in-Eclipse setup
    How to include maven dependencies in war file (WEB-INF/lib) deployed using m2eclipse plugin
    Eclipse problem regarding M2Eclipse/integrated web server