Table of Contents

Maven

Why use Maven ?

Maven is one of several possible build tools, it's easy to use and supported in Netbeans + Eclipse. Maven is preinstalled on mac (3.0.3), maven is also bundled with Netbeans (3.0.5). I prefer downloading latest from http://maven.apache.org

Advantages of using Maven are numerous :

'mvn archetype:generate eza-inno-sach' would use the template to create a new project, in netbeans this is also simplified (just need to use the search form to find the archetype).

What does it take to convert an existing project to Maven ?

  1. You create a new maven project (jar or war) & copy the source
  2. You configure the POM (set parent to company POM parent, usually MentoringSystems. There is no parent JCP project… yet)
  3. You start resolving dependencies

Resolving dependencies :

Creating a new BUILD project (1 build per customer/product) :

  1. Netbeans : New project

First screen : Maven → Web Application

Next :

Next :

I recommend copying the POM of JCPIS_ANALYSE_BUILD_EFFEKT & changing 2 properties : artifactId: build-<customer in normal letters> name: JCPIS_ANALYSE_BUILD_<customer in caps>

  1. fiddle with the options in pom to generate a different build.
  2. time to change the context.xml file (located under Web Pages/META-INF/context.xml)
    easiest way : copy the file from JCPIS_ANALYSE_BUILD_EFFEKT, adjust it so the path & webapp rootkey are unique
  3. Remove the web.xml file from the build !

Company repository :

Think of it as the SVN for all our binary project dependencies.

Setting up a developer machine :

  1. settings.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<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">
	<mirrors>
		<mirror>
			<id>nexus</id>
			<mirrorOf>*</mirrorOf>
			<url>http://svn.jcpis.de:8081/nexus/content/groups/public</url>
		</mirror>
	</mirrors>
	<proxies/>
	<servers>
		<server>
			<id>nexus</id>
			<username>***</username>
			<password>***</password>
		</server>
	</servers>
	<pluginGroups/>
	<profiles>
		<profile>
			<id>nexus</id>
			<!--Enable snapshots for the built in central repo to direct -->
			<!--all requests to nexus via the mirror -->
			<repositories>
				<repository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<updatePolicy>always</updatePolicy>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<updatePolicy>always</updatePolicy>
						<enabled>true</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<updatePolicy>always</updatePolicy>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<updatePolicy>always</updatePolicy>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>nexus</activeProfile>
	</activeProfiles>
</settings>

possible locations :

bundled maven (mac) :
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/java/maven/conf/settings.xml

preinstalled maven (mac) :
/usr/share/maven/conf/settings.xml

installed maven (mac, probably the same for linux) :
/<wherever you've placed it>/maven/conf/settings.xml

installed maven (windows) :
<userdir>/.m2/settings.xml

  1. Check out MentoringSystems parent pom & build this one first, it contains some settings needed to recover all company projects !
  2. Check out the project you need to work on

(for example, work on model)

Important : updating an existing maven project :

Some of the old projects (like jav2013 etc…) were marked as FINAL versions (version nr does not end with snapshot). Before editting these projects, you need to change the versionnumber :

<version>1.0</version>

becomes

<version>1.1-SNAPSHOT</version>

And change the reference in projects where jav2013 is used, This ensures the projects will use your latest version.

depending on the version, a different repository is used. You can't change final versions (repository won't allow it). Think of this as an extra precaution upon production release, you can ALWAYS return to a previous version or you can fix a project to use a previous version whilst development works with a newer version.

JCPIS_ANALYSE overrides

Build projects are essentially overrides, you can override ANY of the other projects by simply copying the file over to the build project, (correct folder structure required) & editting it.

JCPIS_ANALYSE plugins

Several plugin projects exist, making use of detached spring configuration. Examples are JCPIS_ANALYSE_CODIE, JCPIS_ANALYSE_SOFTFAIR.

When adding controllers it would be best to check other projects for the ORDER parameter on SimpleUrlHandlerMapping. In the future it might be better to add naming conventions or start with using spring 3.1 annotations to reduce the xml code.

JCPIS_ANALYSE login plugin

Interface : de.jcpis.analyse.security.AuthenticationFilter

Working implementation : Codie loginfilter.