Draft walk-through for manually converting a Fluffy Bunny project to Maven layout.

Home   »   Draft walk-through for manually converting a Fluffy Bunny project to Maven layout.

# 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 2 (changing your configuration files.

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).

```bash
mkdir -p src/main 
mkdir -p src/test/resources
git mv Components src/main/components
git mv Sources src/main/java
git mv Resources src/main/resources
git mv WebServerResources src/main/webserver-resources
git mv Tests src/test/java
```

If the project does not have a `Tests` folder, you can substitute:

```bash
mkdir -p src/test/java
```

For any directories that are empty, you can add an empty `.gitkeep` file so that the structure is preserved in the repository:

```bash
touch src/test/resources/.gitkeep
touch src/test/java/.gitkeep
```

# 2. Updating Eclipse project files

## 2.1 `.classpath`
Just copy in this file:
```xml


	
		
			
		
	
	
		
			
		
	
	
		
			
		
	
	
		
			
			
		
	
	
		
			
		
	
	
		
			
			
		
	
	

```

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

 ```xml


	[Your Project Name]
	
	
	
	
		
			org.eclipse.jdt.core.javabuilder
			
			
		
		
			org.objectstyle.wolips.incrementalbuilder
			
			
		
		
			org.eclipse.m2e.core.maven2Builder
			
			
		
	
	
		org.eclipse.m2e.core.maven2Nature
		org.maven.ide.eclipse.maven2Nature
		org.eclipse.jdt.core.javanature
		org.objectstyle.wolips.incrementalapplicationnature
	

```

## 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=
```

## 2.4 `woproject`

If convenient, copy over the `.patternset` files from a pristine Maven project. Otherwise, `classes.exclude.patternset`:

```
build.properties
```

`classes.include.patternset`:

```
**/*.class
*.properties
```

`resources.exclude.patternset`:

```**/*.eomodeld~/
**/*.woa/**
**/*.framework/**
**/Info.plist
```

`resources.include.patternset`:

```
src/main/components/**/*.wo/**/*
src/main/components/**/*.api
src/main/resources/**/*
```

`wsresources.exclude.patternset`:

```
**/*.woa/**
**/*.framework/**
**/*.eomodeld~/**
```

`wsresources.include.patternset`:

```
src/main/webserver-resources/**/*
```

# 3. Manually add your project's dependencies

If you have any depenencies outside of WO and Wonder, go into your `pom.xml` and add the missing dependencies from your `Libraries` folder. You can then delete the `Libraries` folder.

# 4. Update any resource references in any `.eogen` files

These will all need to be manually updated to find the resources in the new project structure. If you're using per-project custom generator templates, move these to `src/main/resources/templates`.

# 5. Still have problems? (FAQ)

Before proceeding, make sure of the following

* You're using the most recent version of the WO maven plugin (wolifecycle). As of now, that's 2.4-SNAPSHOT.
* You're using the most recent version of Project Wonder. As of now, that's 7.3-SNAPSHOT.
* In WOLips Preferences -> Build, you've got 'generate bundles' checked
* You've deleted the old Eclipse launch configuration for your application and re-created it (an old launch configuration will still be referencing the classpath from the ant project).
* You've rebuilt your project cleanly by:
  * Disabling 'Project -> Build Automatically'
  * Going to 'Project -> Clean...' to rebuild your project
  * Re-enabling 'Project -> Build Automatically'

### My components are in subfolders inside src/main/components and are not copied to the WOA

Set the configuration option flattenComponents in the configuration for wolifecycle-maven-plugin.

```

	org.wocommunity
	wolifecycle-maven-plugin
	2.4-SNAPSHOT
	true
	
		true
	

```

### My application doesn't find the session class, an exception is thrown "Class 'Session' exists ([...]) but is not a subclass of WOSession"

Override _sessionClass() in your Application class to return your actual session class.

```
@Override
protected Class _sessionClass() {
	return my.very.own.Session.class;
}
```

### My application doesn't find the Main class, an exception is thrown "Class 'Main' exists but is not a subclass of WOComponent"

Install the correct class for the name 'Main' by using ERXPatcher, you do this in the installPatches method in your Application class.

```
@Override
public void installPatches() {
	super.installPatches();
	ERXPatcher.setClassForName(my.own.Main.class, "Main");
}
```

Leave a Reply

Your email address will not be published. Required fields are marked *