FAQ

  1. How do I make Maven output more information when JUnit testcases fail?
  2. How do I make Maven SHUT UP - I drown in information?
  3. How do I inspect the SQLite DB's contents?
  4. How do I change the Maven local repository location on the disk?
  5. How do I build the Net4Care web site locally?
  6. How do I tell Maven to execute a specific .class file?
  7. How do I keep two or more branches of the project in Eclipse?
  8. How do I change the default port (8082) of the jetty server?
How do I make Maven output more information when JUnit testcases fail?

Set the useFile property

mvn test -Dsurefire.useFile=false

Now you can see line numbers within the failing test case in JUnit

Source: http://stackoverflow.com/questions/5080540/displaying-junit-fail-messages-through-maven2

[top]


How do I make Maven SHUT UP - I drown in information?

mvn -q test

[top]


How do I inspect the SQLite DB's contents?

On Windows use the resources/sqlite3.exe on the db, for instance one test case stores in n4c_osgi/n4c_test/xdstest.db Use sqlite3.exe on this file which acts as a shell where you may query SQL. Read SQLiteXDSRepository.java for table layout.

Nice commands:

.tables = list all tables

.schema = list all schemas

Remember to end all SQL commands with a semi-colon (;).

[top]


How do I change the Maven local repository location on the disk?

Locate the file $M2_HOME/conf/settings.xml. Edit the 'local repository tag' like e.g.

	  <localRepository>>d:/proj/.m2</localRepository>
More info at: http://maven.apache.org/settings.html (My SSD disk C: ran almost full :)

If you use Eclipse, the above will probably create a ton of compilation errors like "... is missing required library:". This is often because the Maven user settings points to the wrong settings.xml but the default values will guess correctly if you have your repository in the default location - and you just changed that.

To repair, hit menu Window-Preferences, and select Maven-User Settings in the dialog. Browse to the proper settings.xml file and you should be on the right track again.

[top]


How do I build the Net4Care web site locally?

mvn -q site

and point your web browser at

target/site/project-info.html

[top]


How do I tell Maven to execute a specific .class file?

Change to the root directory with the POM file. Then use exec:java goal, like

mvn exec:java -Dexec.mainClass="com.hbc.client.HomeMonitorApp"
	 

[top]


How do I keep two or more branches of the project in Eclipse?

This is pretty tricky as Eclipse cannot import two project that have the same name; and as checking out another branch does not rename a project, Eclipse refuses to have more than one instance at the time.

The trick is to rename the project(s) as several resources on the web mention. Here is my recipe:

  1. Checkout the branch using command-line SVN into a new folder (or rather, just do not use Eclipse to do it)
  2. Run 'mvn eclipse:eclipse'
  3. For each of the subprojects (n4c_forwarder, etc.) edit the .project file and do the renaming of the project in the 'name' tag. For instance, I renamed all project names from 'X' to 'X01' for a relase 0.1 branch.
  4. Now import the folder into a new Eclipse working set. This set will most likely have tons of compilation errors because the build paths of each new project points to the other projects in Eclipse with similar names. We have to fix that.
  5. For each project in the branch working set, fix the build paths: menu project->properties; select java build path; select tab properties; and remove all references to project X and replace them with references to X01.
This should do it.

[top]


How do I change the default port (8082) of the jetty server?

To change the default port edit the following property in the pom.xml file:

		<properties>
		    	...
		    	<org.osgi.service.http.port>8082</org.osgi.service.http.port>
		    	...
    		</properties>
		

[top]