MarioNote

December 15, 2012

Maven command to attach source and javadoc

Filed under: Java — mariojump @ 8:23 am

The steps to have Maven attach source and Javadoc files are as follows.

First, edit pom.xml as shown in:

http://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html

Then, run:

mvn package

Advertisements

December 1, 2012

Maven command to generate a jar file that includes dependencies

Filed under: Java — mariojump @ 8:12 pm
Here is a Maven command to generate a jar file that includes dependencies.
mvn assembly:assembly -DdescriptorId=jar-with-dependencies

According to the Maven documentation, assembly:assembly is deprecated, though.

https://maven.apache.org/plugins/maven-assembly-plugin/plugin-info.html

November 24, 2012

“Database is locked” on SQLite

Filed under: Database,Java,SQLite,Uncategorized — mariojump @ 8:42 pm

An article below helped me remove SQLite’s “Database is locked” messages.

http://sqlite-howto.blogspot.jp/2009/08/sqlite-s-database-is-locked-solution.html

First, I added the following lines to all methods that use Hibernate.
session.close();
sessionFactory.close();

For those non-Hibernate code, (plain JDBC codes), ensure it has something like:

stat.close();

conn.close();

“Database is locked” disappeared.

August 25, 2012

Maven – How do I skip the tests? -Dmaven.test.skip=true

Filed under: Java,Useful sites — mariojump @ 8:00 pm

At default, Maven runs JUnit tests.  There are occasions that we would like to skip JUnit tests.

Maven FAQ had answers.

http://maven.apache.org/general.html#skip-test

By adding a command line parameter,

-Dmaven.test.skip=true

Maven skips JUnit tests.

Alternatively,

-DskipTests=true

can be used as well, according to the FAQ.

 

 

 

September 19, 2011

Maven 2.2.1 – [WARNING] repository metadata for: ‘org.apache.maven.plugins’ could not be retrieved from repository

Filed under: Java,XML — mariojump @ 10:22 pm
Tags:

On Maven 2.2.1, I had trouble when executing, “mvn archetype:generate”, with the following errors.

[INFO] Searching repository for plugin with prefix: ‘archetype’.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: ‘org.apache.maven.plugins’ could not be retrieved from repository: central due to an error: Error transferring file: Connection timed out
[INFO] Repository ‘central’ will be blacklisted

Finally, it turned out that the proxies section in settings.xml was not commented/uncommented properly. Windows XP Firewall or security software had nothing to do with the error.

August 27, 2011

Trang – Multi-format schema converter based on RELAX NG

Filed under: Java,Software Development,Ubuntu,XML — mariojump @ 10:53 am

Trang is a schema converter.

Install Trang on Ubuntu 10.04 LTS.
$ sudo apt-get install trang

This time, I used Trang to generate an XSD file from an XML file.

$ trang -I xml -O xsd InputXmlFile.xml OutputXSDFile.xsd

July 31, 2010

cron-like job setting on Windows XP with schtasks command

Filed under: Sample code,Windows — mariojump @ 4:57 am
Tags: ,

Task Scheduler GUI on Windows XP does not appear to allow us to set a job every 5 minutes.

Instead, schtasks command allows cron-like setting.

To set a job (a batch file) to run every 5 minutes, here’s a sample command.

C:\>schtasks /Create /SC MINUTE /MO 5 /TN yourjob_every5min.bat /TR C:\yourfolder\yourbatchfile.bat

June 4, 2010

Hadoop Installation Note (Standalone)

Filed under: Java,Linux,step-by-step — mariojump @ 10:30 pm
Tags: ,

This is a note when I installed Hadoop on a single machine (standalone).

I followed Hadoop Quick Start available at:
http://hadoop.apache.org/common/docs/r0.20.0/quickstart.html

Check Java version — Java 1.6.x is required, and Sun version is preferred. See:
http://hadoop.apache.org/common/docs/r0.20.0/quickstart.html

Download hadoop-0.20.2.tar.gz from:
http://hadoop.apache.org/mapreduce/releases.html#Download

$ tar xvzf hadoop-0.20.2.tar.gz

Skip rsync and ssh installation, as they are already available on the machine.

// Check the command usage:
$ cd hadoop-0.20.2
$ bin/hadoop
Usage: hadoop [–config confdir] COMMAND
where COMMAND is one of:
namenode -format format the DFS filesystem
secondarynamenode run the DFS secondary namenode
namenode run the DFS namenode
datanode run a DFS datanode
dfsadmin run a DFS admin client
mradmin run a Map-Reduce admin client
fsck run a DFS filesystem checking utility
fs run a generic filesystem user client
balancer run a cluster balancing utility
jobtracker run the MapReduce job Tracker node
pipes run a Pipes job
tasktracker run a MapReduce task Tracker node
job manipulate MapReduce jobs
queue get information regarding JobQueues
version print the version
jar run a jar file
distcp copy file or directories recursively
archive -archiveName NAME * create a hadoop archive
daemonlog get/set the log level for each daemon
or
CLASSNAME run the class named CLASSNAME
Most commands print help when invoked w/o parameters.

$ mkdir input
$ cp conf/*.xml input
$ bin/hadoop jar hadoop-*-examples.jar grep input output ‘dfs[a-z.]+’
Error: JAVA_HOME is not set.

$ /usr/java/latest/bin/java -version
java version “1.6.0_16”

$ export JAVA_HOME=/usr/java/latest
[added this line in the .bashrc]
Reference: http://www.atmarkit.co.jp/fjava/special/distributed03/distributed03_1.html

Try again:
$ bin/hadoop jar hadoop-*-examples.jar grep input output ‘dfs[a-z.]+’

No error message is shown this time.
$ cat output/*
1 dfsadmin

May 13, 2010

GCJ (GNU Compiler for Java) Installation and Usage How-To

Filed under: Java,Ubuntu — mariojump @ 1:30 pm

GCJ (GNU Compiler for Java) can be installed on Ubuntu Linux with the following command.

$ sudo apt-get install gcj

This worked on Ubuntu 9.10 and 10.04.

To use it, (assuming you have a package and classes as specified,)

$ gcj -o yourcommandname –main=packagename.MainClassName packagename/OtherClassName.java packagename/MainClassName.java

January 17, 2010

Installing Subversive Plugin on Eclipse 3.5

Filed under: Android,Software Development,step-by-step — mariojump @ 10:49 am

Subversive is an Eclipse plugin to integrate with Subversion (SVN).

Subversive can be downloaded and installed from the Galileo Update Site.

Help > Install New Software… > select Galileo – http://download.eclipse.org/releases/galileo > Collaboration Tools.

Select:
Subversive SVN Team Provider (Incubation) 0.7.8.I20090904-1300
(This is the latest one as of Jan 17, 2010.)

Then, when I tried to use it with ProjectLocker, I got the following error.
“Selected SVN connector library is not available or cannot be loaded.”

To cope with this,
Add
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
to the software update site in Eclipse.

And select:
Subversive SVN Connectors and the connector for your Subversion version.
Since ProjectLocker offers Subversion 1.6.6, I chose:

* Subversive SVN Connectors 2.2.1.I20091009-1900
* Native JavaHL 1.6 Implementation (Optional) 2.2.1.I20091009-1900
* JavaHL 1.6.0 Win32 Binaries (Optional) 2.2.1.I20091009-1900

Then, I could finally synchronize with ProjectLocker’s subversion.

[References]
http://www.eclipse.org/subversive/downloads.php
http://www.projectlocker.com/site/scm

Next Page »

Blog at WordPress.com.