Migrate a folder from one Subversion server to another

I needed to migrate a folder from one Subversion server to another. So, I attempted to follow this page to use dump with svndumpfilter. This combo led me to a lot of issues. The dump command exports all the commits for a repository while svndumpfilter attempts to filter the folder I am interested to keep. Unfortunately, the filter tool is very buggy and unable to filter correctly. Here are the scenarios that did not work for me:

If a commit contains a move action with source location outside of the folder I want to include, the filter fails. I had to include that location when filter. If a commit contains an add action, the parent folder has to exist when loading. I could resolve this by creating the parent folder manually. If a commit contains a delete action and the target folder/file doesn’t exist, the load fails. I could try to create the folder/file manually in an attempt to not fail the delete action. This trick didn’t work when the commit includes a delete of parent folder before attempt to delete the file in it.

When I about to give up, I came across svndumpfilter3 and was happy to find it dump/load without an error. :) Here are the commands I used:

svnadmin dump [path to source repository] | ./svndumpfilter3 --untangle=[path to source repository] [target folder to include] > dump_file.dmp

svnadmin load [path to target repository] --parent-dir [path to target parent dir] < dump_file.dmp

Adding print feature to a GWT app

Enable print: I was able to add print feature to a GWT app by using gwt-print-it library. I used last example in the documentation to get the printing to work (see included code fragment below).

Print.it(“<!DOCTYPE HTML PUBLIC ‘-//W3C//DTD HTML 4.01//EN’ ‘http://www.w3.org/TR/html4/strict.dtd’>&#8221;, “<link rel=StyleSheet type=text/css media=paper href=/paperStyle.css>”, RootPanel.get(“myId”));

I had to use absolute URLs instead of relative paths for CSS href attributes. Although this library can potentially help me to eliminate the need to create a separate print friendly display code, this created several challenges:

CSS link difference: After attempted to print using several browsers, I discovered that different browsers will interpret href attribute for the CSS links differently. To avoid the need to create browser specific code, I tried the following workaround:

Element body = RootPanel.getBodyElement();
Print.it((Element) body.getParentElement());

This will print the whole page, which includes all the CSS references that are already working for the browsers and eliminate the need to define separate CSS links that does not work across browsers.  :)

Image link difference: I also discovered that the image links are also broken when attempt to print. This is a known “feature” according to gwt-print-it documentation. So, instead of defining images using <img> tags, I used background-image definition in my CSS file and use a div tag with an ID to associate with the CSS definition. See answer #7 in this page for code example. This effectively unified how browsers reference images, which always relative from where CSS file is located. This means I no longer need to create print specific URLs for images. :)

Background image printing: Once I started to use background images, Chrome stopped printing the images. A search on Internet led me to this solution, which worked great. :) For Mozilla, users can enable printing of background images by select Options tab in the Print window and check “Print Background Images”.

SVN::Notify

After setting up an instance of SVN using the instructions I found here. I wanted to setup email notification for every commit on a SVN server. I was able to setup SVN::Notify using the tutorial on this page. When attempting to run perl -MCPAN -e 'install SVN::Notify', the install command complained that MakeMaker version is not new enough. So, I went to this CPAN page and download the module and install it before resume installing SVN::Notify. The install command complained again about a missing directory. I repeated the command and the installation completed successfully. :)

The instruction statement on “replace the existing call to commit-email.pl” wasn’t very clear to me. It didn’t say which file I should edit. I eventually figured out that I should make a copy of [SVN_REPOSITORY]/hooks/post-commit.tmpl file and name the new file [SVN_REPOSITORY]/hooks/post-commit. In the file, I commented out the following line:

mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf

Next, I added the following line:

/usr/bin/svnnotify --repos-path "$1" --revision "$2" --to me@mydomain.com --user-domain mydomain

Please note that I replaced me@mydomain.com and mydomain with correct values for my environment. I also ran the following command to make it executable.

chmos +x post-commit

After completed all these, I was able to receive the email notification every time an user commit to the repository. :)

GWT, Maven, Eclipse and WebLogic: take 2

Maven + GWT
I needed to create a GWT project using maven again. The original post lacked some details. This time, I got it to work with a slightly different steps. First, I ran the following command:

mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchtypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.4.0 -DarchetypeRepository=repo1.maven.org

Somehow, Maven didn’t pickup the group ID and artifact ID. So, I had to choose from one of the listed item.

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 337
Choose org.codehaus.mojo:gwt-maven-plugin version: 
1: 1.1
2: 1.2
3: 2.1.0
4: 2.1.0-1
5: 2.4.0
Choose a number: 5: 5

Next, I defined the properties for my project.

Define value for property 'groupId': : com.my.app.package.name
Define value for property 'artifactId': : directoryNameForTheGeneratedProject
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.my.app.package.name
Define value for property 'module': : moduleName

Now I can run the generated module with the following command. This will bring up a console. All I have to do is copy the URL and then past it in the browser.

mvn gwt:run

Maven + Eclipse
Next, I followed the instructions on this page to run the following command within the project folder to enable support for Eclipse:

mvn eclipse:eclipse

Then, I use Eclipse to import existing project into workspace to open the project. Eclipse complained that the default directory for the project should be set to /PorjectFolder/src/main/webapp/WEB-INF/classes Since I want to use Maven to build, I ignore the error by right click on the error, choose quick fix, choose Do not use the WAR directory for ProjectName launching and deploying (this disables management of WEB-INF)

Maven + WebLogic
I noticed that the JRE libraries were referencing version Java SE 7 jars, I changed it to 6 so the project will be compatible with WebLogic 11g. For WebLogic 12c, see this post.

I followed the instructions to configure WebLogic 11g with Maven. The available commands for 11g are slightly different from 12c. They are are deploy, help, list-apps, redeploy, start-app, stop-app, undeploy, update-app. Once I completed the configuration, I was able to run mvn weblogic:list-apps command. Next, I ran mvn package to create the WAR file before attempted mvn weblogic:deploy. I was able to load the application in my browser! :)

Maven and WebLogic 12c

Today, I tried to use Maven with WebLogic 12c. The documentation for installation is straight forward. I was able to execute mvn wls:help without any difficulty.

However, using the WebLogic plugin wasn’t as easy. In order to run commands such as mvn wls:start-server, I needed to configure various parameters, such as middlewareHome, domainHOme, user, password, and name. Instead of specifying these parameters every time I run the command, I added the following config to pom.xml:

<!-- WebLogic Server 12c Maven Plugin -->
<plugin>
    <groupId>com.oracle.weblogic</groupId>
    <artifactId>wls-maven-plugin</artifactId>
    <version>12.1.1.0</version>
    <configuration>
        <artifactLocation>
            com.oracle.weblogic:wls-dev:zip:12.1.1.0
        </artifactLocation>
        <middlewareHome>/export/apps/wls</middlewareHome>
        <domainHome>/export/apps/wlsdomains/d1</domainHome>
        <user>weblogic</user>
        <password>welcome1</password>
        <name>applicationName</name>
    </configuration>
 </plugin>

After that, I was able to run the following commands without manually entering additional parameters. :)

mvn wls:start-server
mvn wls:deploy
mvn wls:list-apps
mvn wls:undeploy
mvn wls:stop-server

Initially, I noticed the following error when attempting to deploy/undeploy the web app. This appears to go away after I restarted the server.

[ERROR] Unknown lifecycle phase "applicationName". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException