Maven command to run a Java main class

There might be more than one Java classes in a Maven project that contains the main() function. To pick up a specific one to run, you can try the following command:

[sourcecode]
mvn exec:java -Dexec.mainClass="my_main_class_name"
[/sourcecode]

In case the memory is not enough, try the following command:

[sourcecode]
export MAVEN_OPTS=-Xmx1024m
[/sourcecode]
where 1024m is the max heap memory

Reimport Maven module in Intellij

I recently removed a Maven module from my Intellij project. Shortly after, I tried to reimport the same module again, but somehow Intellij stubbornly refuse to show it in the Project panel. Eventually I looked into the MyProject.ipr file and found the module’s pom.xml file appeared in the ignoreFiles list.

[sourcecode]
<option name="ignoredFiles">
<set>
<option value="/path/to/my/module/pom.xml" />
</set>
</option>
[/sourcecode]

After I deleted the specific line with the pom.xml, I was able to reimport the module successfully again.

Start Apache server on Cygwin 1.7 and Windows 7

I installed the full Cygwin 1.7 package on Windows 7. When I try to start Apache server following the linux style by running command
$ /usr/sbin/apachectl2 start
I got “Bad system call” error.

After some web search and trial and error, I finally got it work. Below are the steps that I’ve tried. Not sure whether all are necessary though.

Step 1: right click the Cygwin terminal and select “Run as adminstrator”

Step 2: create correct user and group info. Not sure whether this step is necessary.
$ mkpasswd.exe -l
$ mkgroup.exe -l

Step 3: configure server by running command
$ cygserver-config

Step 4: start cygserver
$ net start cygserver

Step 5: start apache
$ /usr/sbin/apachectl2 start