Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hugithordarson/e9a49e91fbcebe204e0feb4989f55631 to your computer and use it in GitHub Desktop.
Save hugithordarson/e9a49e91fbcebe204e0feb4989f55631 to your computer and use it in GitHub Desktop.

0. Preparing

To prepare, turn off automatic builds in Eclipse (otherwise, Eclipse is going to be really, really "helpful" by creating folders, modifying .classpath etc.). Keep automatic builds off until you've at least finished step 3 (adding a pom file).

Once you've changed the configuration files, close the project and open it again, then turn on the Eclipse builds again.

1. Creating folders and moving stuff around

Here are the modifications you have to do to your project's layout, expressed in bash (as if your working directory is your project's root).

mkdir src/main
mv Components src/main/components
mv Sources src/main/java
mv Resources src/main/resources
mv WebServerResources src/main/webserver-resources

2. Updating Eclipse project files

2.1 .classpath

Just copy in this file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
   	<attributes>
   		<attribute name="maven.pomderived" value="true"/>
   	</attributes>
   </classpathentry>
   <classpathentry kind="src" output="target/classes" path="src/main/java">
   	<attributes>
   		<attribute name="optional" value="true"/>
   		<attribute name="maven.pomderived" value="true"/>
   	</attributes>
   </classpathentry>
   <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
   	<attributes>
   		<attribute name="maven.pomderived" value="true"/>
   	</attributes>
   </classpathentry>
   <classpathentry kind="src" output="target/test-classes" path="src/test/java">
   	<attributes>
   		<attribute name="optional" value="true"/>
   		<attribute name="maven.pomderived" value="true"/>
   	</attributes>
   </classpathentry>
   <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
   	<attributes>
   		<attribute name="maven.pomderived" value="true"/>
   	</attributes>
   </classpathentry>
   <classpathentry kind="output" path="target/classes"/>
</classpath>

2.2 .project

Just copy in this file, but replace [Your Project Name] with your Eclipse project name.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
   <name>[Your Project Name]</name>
   <comment></comment>
   <projects>
   </projects>
   <buildSpec>
   	<buildCommand>
   		<name>org.eclipse.jdt.core.javabuilder</name>
   		<arguments>
   		</arguments>
   	</buildCommand>
   	<buildCommand>
   		<name>org.objectstyle.wolips.incrementalbuilder</name>
   		<arguments>
   		</arguments>
   	</buildCommand>
   	<buildCommand>
   		<name>org.eclipse.m2e.core.maven2Builder</name>
   		<arguments>
   		</arguments>
   	</buildCommand>
   </buildSpec>
   <natures>
   	<nature>org.eclipse.m2e.core.maven2Nature</nature>
   	<nature>org.maven.ide.eclipse.maven2Nature</nature>
   	<nature>org.eclipse.jdt.core.javanature</nature>
   	<nature>org.objectstyle.wolips.incrementalapplicationnature</nature>
   </natures>
</projectDescription>

2.3 build.properties

Make sure the "classes.dir" property is "target/classes". Example file:

classes.dir=target/classes
component.inlineBindingPrefix=$
component.inlineBindingSuffix=
component.wellFormedTemplateRequired=false
customInfoPListContent=
eoAdaptorClassName=
principalClass=app.Application
project.name=Hugi
project.name.lowercase=hugi
project.type=application
webXML=false
webXML_CustomContent=

3. Add a pom file

This is what a new WO maven application's POM file looks like. All you have to do is replace [YOUR GROUP ID], [YOUR ARTIFACT ID] and [YOUR WO APPLICATION'S NAME] with the appropriate values.

<?xml version="1.0" encoding="UTF-8"?>
<project 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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>[YOUR GROUP ID]</groupId>
	<artifactId>[YOUR ARTIFACT ID]</artifactId>
	<packaging>woapplication</packaging>
	<version>1.0.0-SNAPSHOT</version>
	<name>[YOUR WO APPLICATION'S NAME]</name>
	<properties>
		<webobjects.version>5.4.3</webobjects.version>
		<wonder.version>7.0.0-SNAPSHOT</wonder.version>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<build>
		<finalName>${project.artifactId}</finalName>
		<plugins>
			<plugin>
				<groupId>org.objectstyle.woproject.maven2</groupId>
				<artifactId>maven-wolifecycle-plugin</artifactId>
				<version>2.3-SNAPSHOT</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>wonder.core</groupId>
			<artifactId>ERExtensions</artifactId>
			<version>${wonder.version}</version>
		</dependency>
		<dependency>
			<groupId>wonder.core</groupId>
			<artifactId>WOOgnl</artifactId>
			<version>${wonder.version}</version>
		</dependency>
		<dependency>
			<groupId>wonder.core</groupId>
			<artifactId>ERPrototypes</artifactId>
			<version>${wonder.version}</version>
		</dependency>
		<dependency>
			<groupId>com.webobjects</groupId>
			<artifactId>JavaWebObjects</artifactId>
			<version>${webobjects.version}</version>
		</dependency>
		<dependency>
			<groupId>com.webobjects</groupId>
			<artifactId>JavaEOAccess</artifactId>
			<version>${webobjects.version}</version>
		</dependency>
		<dependency>
			<groupId>com.webobjects</groupId>
			<artifactId>JavaFoundation</artifactId>
			<version>${webobjects.version}</version>
		</dependency>
	</dependencies>
</project>

4. Manually add your project's dependencies

If your application has depenendencies other than WO and Wonder, go into your pom.xml and add them.

@hugithordarson
Copy link
Author

Remember to add "change destination path for eogenerator"

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