Simply add the property -Dmaven.test.skip=true to your Maven command. Here is an example:
[INFO] [surefire:test]
[INFO] Tests are skipped.
file=/home/fahd/dummy while read line do echo "$line" done < $fileThe problem with this is that the "read" command automatically removes leading whitespace from each line and also concatenates a line ending with a backslash with the one following. This means that you cannot properly process a file with lots of leading whitespace e.g. xml files.
The trick around this, is to redefine your IFS (Internal Field Separator) variable. By default, IFS is set to the space, tab and newline characters to delimit words for the read command. This is how you can amend your script:
file=/home/fahd/dummy OIFS=$IFS IFS= while read -r line do echo "$line" done < $file IFS=$OIFSFirst save the current value of IFS into a temporary variable called OIFS. Then blank out IFS. When you have finished reading your file, set IFS back to its original value of OIFS.
We also provide the read command with the -r flag, so that it treats each backslash to be part of the input line and does not concatenate it with the next line.
Fortunately, there is a way to ask the JVM to execute some clean-up code before exiting. This is done by using ShutdownHooks which are registered with System Runtime. The JVM starts all registered shutdown hooks concurrently when shutting down.
Here are the steps involved when creating shutdown hooks:
1. Create the shutdown hook class:
public class AppShutdownHook extends Thread{ public void run(){ logger.info("Running shutdown hook...") ; //cleanup e.g. close database connections } }2. Register the shutdown hook:
public class App{ public App(){ Runtime.getRuntime(). addShutdownHook(new AppShutdownHook()) ; } }Note that no guarantee can be made about whether or not any shutdown hooks will be run if the JVM aborts with the SIGKILL signal (kill -9) on Unix or the TerminateProcess call on MS Windows.
However, SIGTERM (kill with no arguments) will work.
Reference:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
Step 1: Create your management interface which consists of all the attributes which can be read or set and all the operations that can be invoked. In this case, we want to change the logging level of our application.
public interface MyAppMBean{ public void setLoggingLevel(String level) ; public String getLoggingLevel() ; }Step 2: Create a class which implements the MBean interface
import java.lang.management.ManagementFactory; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.log4j.Level; import org.apache.log4j.Logger; import com.sun.jdmk.comm.HtmlAdaptorServer; public class MyApp implements MyAppMBean{ private static Logger logger = Logger.getLogger(MyApp.class); public void go() throws Exception{ while(true){ logger.debug("DEBUG") ; logger.info("INFO") ; Thread.sleep(2000); } } public void setLoggingLevel(String level){ logger.info("Setting logging level to: " + level); Level newLevel = Level.toLevel(level, Level.INFO); Logger.getRootLogger().setLevel(newLevel); } public String getLoggingLevel(){ return Logger.getRootLogger().getLevel().toString() ; } }Step 3: Register the MBean with the MBeanServer. Also register an HTMLAdaptorServer which allows us to manage an MBeanServer through a web browser.
public static void main(String[] args) throws Exception{ MyApp app = new MyApp() ; ObjectName objName = new ObjectName("MyApp:name=MyApp"); MBeanServer server = ManagementFactory.getPlatformMBeanServer(); server.registerMBean(app, objName); int portNumber=9393; ObjectName htmlName = new ObjectName( "MyApp:name=MyAppHtmlAdaptor,port="+portNumber) ; HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber); html.setPort(portNumber); server.registerMBean(html, htmlName); html.start(); app.go(); }Step 4: Compile. Make sure you have log4j, jmxtools and a log4j properties file in your classpath
Step 6: Run MyApp. You need to add the following JVM properties:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=falseStep 5: Open jconsole
After more than 34 months of active development, and with the contributions of thousands, we’re proud to announce that we’re ready. It is our expectation to ship Firefox 3 this upcoming Tuesday, June 17th. Put on your party hats and get ready to download Firefox 3 - the best web browser, period.I've been using the betas and RCs for some time now and can't wait to get my hands on this release. If you haven't already pledged to download it, and help set a world record for the most software downloaded in 24 hours, do so now: http://www.spreadfirefox.com/en-UK/worldrecord/ (Total pledges 1,109,453 so far)
The reason is that we wanted to develop a set of icons that would scale better to some new platforms like the iPhone and other mobile devices. So the new favicon is one of those, but we’ve also developed a group of logo-based icons that all hang together as a unified set.