Skip to content

Instantly share code, notes, and snippets.

@hugithordarson
Last active June 21, 2023 03:13
Show Gist options
  • Save hugithordarson/d2ba6da9e4942f4ece95d7a721159cd1 to your computer and use it in GitHub Desktop.
Save hugithordarson/d2ba6da9e4942f4ece95d7a721159cd1 to your computer and use it in GitHub Desktop.

Getting started with WO Development using Maven

This tutorial focuses on getting started with Maven in Eclipse/Development. Maven and the Maven integration plugin are bundled with Eclipse so you don't need to install anything additional.

We don't cover Maven building on the CLI nor do we discuss concepts or how any of this actually works. This just gets the darned thing up and running, we can talk concepts and understanding later. So:

Let's set it up

1. Let Maven know WO/Wonder exists

Maven needs to know where to fetch the WO/Wonder frameworks and jars. If you're starting fresh, that means copying settings.xml (seen below in this gist) into ~/.m2/settings.xml. Now Maven knows where WOCommunity keeps it's stuff.

2. Let Eclipse know how to create new WO/Wonder projects

Open Eclipse. Go to Preferences and select Maven -> Archetypes. Click Add Remote Catalog and insert the url below in the Catalog file field. Enter anything you want for Description, such as "WOCommunity".

https://maven.wocommunity.org/content/groups/public/archetype-catalog.xml

Creating a project

  • Go to File -> New -> Other and select Maven Project
  • Click Next >
  • From the Catalog popup, select the archetype catalog you added previously
  • Select erxapplication-archetype (3.0 is current at the time of writing)
  • Click Next >
  • In the next step, if you don't know what Group Id and Artifact Id means, just write test into both fields. These can be easily altered later and test will do just fine. Version and Package can be left as is.
  • Set JavaVersion to 1.8 (or whatever your preferred java version is) and WonderVersion to 7.2 (latest stable release of Wonder when this is written).
  • Click Finish and we're done.

Congratulations! You have a Maven project! You can now run your application like any old WO application.

<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.objectstyle.woproject.maven2</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>wocommunity.releases</id>
<name>WOCommunity Releases Repository</name>
<url>
https://maven.wocommunity.org/content/groups/public
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>wocommunity.snapshots</id>
<name>WOCommunity Snapshots Repository</name>
<url>
https://maven.wocommunity.org/content/groups/public-snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>wocommunity.releases</id>
<name>WOCommunity Releases Repository</name>
<url>
https://maven.wocommunity.org/content/groups/public
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>wocommunity.snapshots</id>
<name>WOCommunity Snapshots Repository</name>
<url>
https://maven.wocommunity.org/content/groups/public-snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
@rkiddy
Copy link

rkiddy commented Apr 8, 2021

Just an FYI, I see a warning in the project after I create:

Build path specifies execution environment JavaSE-13. There are no JREs installed in the workspace that are strictly compatible with this

When I go into the 'Configure Build Path' item, I do not see a way to add a JVM. I am not sure it would make sense to add a JVM there, but it is what it is.

@rkiddy
Copy link

rkiddy commented Apr 8, 2021

I am interested in using mvn on the command-line also, so anything you can say on that would be appreciated.

I would like to see, sometime, if maven can help me with my remote deployments, which I now do in a very hand-scripted and ad hoc manner. I imagine I will have some issues vis a vis git. Can I use a remote copy of the git repo on my remote host, or will I have to check things into github to deploy?

@hugithordarson
Copy link
Author

Hi @rkiddy, thanks for the comments!

I think it's probably best if you throw those questions in the Slack #maven channel or on the mailing list and we'd talk there? Comments on here will probably get lost once this gets moved (at least I hope I'll find some better future home for this in the future than a gist :).

But on topic

  • It's quite easy to do the CLI build, I'll throw up a separate tutorial for the most common stuff maybe? Basically, inside your project folder a mvn package will build your project (the WOA will end up inside a folder called target). If you're building a framework (or any other type of library that other projects will "use" or "depend on", use mvn install. That will perform a build and install the package/framework in your local repository.
  • I'm not sure what could be happening with the Java 13 thing, it should be setting the project's java version to 1.8? We can look at that further in the Slack perhaps?
  • I'm still just doing (shell) scripted deployment, i.e. jenkins performs the builds from git and the built woa is rsync-ed to the server). But it would be interesting to see if other folks are using a more sane approach 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment