www.it-ebooks.info Getting Started with IntelliJ IDEA Exploit IntelliJ IDEA’s unique features to rapidly develop web and Java Enterprise applications Hudson Orsine Assumpỗóo BIRMINGHAM - MUMBAI www.it-ebooks.info Getting Started with IntelliJ IDEA Copyright © 2013 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: October 2013 Production Reference: 1101013 Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 978-1-84969-961-7 www.packtpub.com Cover Image by Abhishek Pandey (abhishek.pandey1210@gmail.com) www.it-ebooks.info Credits Author Project Coordinator Hudson Orsine Assumpỗóo Proofreader Reviewers Amy Johnson Scott Battaglia Tomasz Nurkiewicz Indexer Rekha Nair Acquisition Editors Edward Gordon Production Coordinator Rubal Kaur Kirtee Shingan Lead Technical Editor Mohammed Fahad Romal Karani Cover Work Kirtee Shingan Technical Editors Adrian Raposo Gaurav Thingalaya Copy Editor Tanvi Gaitonde www.it-ebooks.info About the Author Hudson Orsine Assumpỗóo is a Brazilian software engineer with a bachelor’s degree in Information Systems from Universidade Estadual de Montes Claros (Unimontes) He has experience in developing applications in Java EE and ActionScript He also has practical knowledge in Data Warehouse, OLAP tools, and BPMN He is a certified ITIL V3 foundation professional Currently, he is developing, with a friend, a web-based ERP system using the Java EE platform I would like to first thank God, who is present all the days in my life, my family for their support, and a special thanks to my friend Rayldo, who encouraged me while writing this book and helped me organize my time in a way that I could my job as well as write this book Thanks to all friends in Packt Publishing; you really helped me organize and write the content of this book www.it-ebooks.info About the Reviewers Scott Battaglia is a senior Software Development Engineer for Audible.com, the leading provider of premium digital spoken audio information, currently focused on Android development Prior to that, he was an Identity Management Architect and senior Application Developer with Rutgers, The State University of New Jersey He actively contributes to various open source projects, including Apereo Central Authentication Service and Inspektr, and has previously contributed to Spring Security, Apereo OpenRegistry, and Apereo uPortal He has spoken at various conferences, including Jasig, EDUCAUSE, and Spring Forward, on topics such as CAS, Identity Management, Spring Security, and software development practices Scott holds a Bachelor of Science and Master of Science degree in Computer Science from Rutgers University and a joint Master of Business Administration and Master of Public Health—Health Systems and Policy—degree from Rutgers University and the University of Medicine and Dentistry—School of Public Health Scott is on the advisory board for Blanco’s Kids, a group focused on providing public health services to extremely poor communities in the Dominican Republic In his spare time, he enjoys photography, running marathons, learning new programming languages, and sponsoring random Kickstarter projects Tomasz Nurkiewicz is a Software Engineer with years of experience, mostly developing backend with JVM languages He is a Scala enthusiast Presently, he is working on leveraging the power of functional programming in the global banking industry Tomasz strongly believes in automated testing at every level He claims that a functionality not tested automatically is not trustworthy and will eventually break He is always happy to implement monitoring and data visualization solutions and has reviewed the book Learning Highcharts, Packt Publishing in the past He is a data analysis apprentice and a technical blogger (http://nurkiewicz.blogspot.com), speaker at conferences, and trainer Most importantly, he has been a proud user of IntelliJ IDEA for many years www.it-ebooks.info www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub com and as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at service@packtpub.com for more details At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book library Here, you can access, read and search across Packt’s entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books Simply use your login credentials for immediate access www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Getting Started with IntelliJ IDEA 12 Presenting features Smart code completion On-the-fly code analysis Advanced refactoring Navigation and search Tools and frameworks support 10 What is new 11 Installing 12 Configuring 15 Project Structure 16 Virtual machine options 17 Migrating from another IDE 18 What to expect in the near future 18 Summary 19 Chapter 2: Improving Your Development Speed Identifying and understanding window elements Identifying and understanding code editor elements Doing things faster The productivity guide Navigating your source code Using code facilities Live templates Using refactoring techniques Managing your changes Organizing your activities Tasks and context management www.it-ebooks.info 21 22 24 26 26 27 29 30 32 34 35 35 Table of Contents Using TODO marking 37 Plugins 38 JRebel 39 Hungry Backspace 40 Key promoter 40 GenerateTestCase 41 Summary 42 Chapter 3: Working with Databases 43 Chapter 4: Web Development 59 Chapter 5: Desktop Development 83 Database tool 43 Creating the database 44 Connecting to the database 44 Creating tables 47 Manipulating data 50 ORM Support 53 Creating database entities 54 Problems that can occur 56 Summary 57 Creating a web module 59 Configuring the application server 60 Developing our application 64 Configuring the JSF environment 64 Resolving the dependencies 65 Creating the filter code 68 Final adjustments 72 Creating SOAP web services 75 Creating test code 76 Finalizing the web service code 79 Summary 81 Creating the desktop application 83 Discovering the visual editor 84 Creating the web service client 89 Data binding 91 Migrating GUI 95 Summary 97 Index 99 [ ii ] www.it-ebooks.info Preface Developing codes that are correct in a fast manner is a difficult task, even for senior developers In conjunction with the abilities of the developer, great tools are involved in providing a simple, flexible, and fast way of developing software IntelliJ IDEA is one of the most powerful IDEs for Java developers, extending facilities you can find in common IDEs and providing features you’ve probably never seen before In this this book, you will learn how to extract the maximum from IntelliJ IDEA 12, beginning with understanding the basic concepts and applying features in real development challenges You will see your development speed improve naturally and understand why IntelliJ IDEA is considered to be the smartest IDE in the world What this book covers Chapter 1, Getting Started with IntelliJ IDEA 12, presents some features in a superficial way The intention here, is to show you the features you can expect in IntelliJ IDEA The chapter begins by showing common features, then it shows you what is new in this version of the IDE You will also see the differences between the Community Edition and Ultimate versions, and how to install and configure this software At the end of the chapter is a section where you will see what you can expect in the future versions of IntelliJ IDEA Chapter 2, Improving Your Development Speed, will provide a wide range of functionalities that will improve your development speed In the beginning, it presents to you the main visual interface of the IDE After this, it shows you how to improve your productivity using the features of IntelliJ IDEA such as the productivity guide, live templates, and navigation usabilities More development speed techniques are discussed later in the chapter, such as organizing tasks using your favorite issue tracker and how to use TODO marks At the end of the chapter, a small list of diverse plugins is presented www.it-ebooks.info ... with any aspect of the book, and we will our best to address it [4] www.it-ebooks.info Getting Started with IntelliJ IDEA 12 This introductory chapter will present some features of IntelliJ IDEA. .. confluence.jetbrains.com/display/IntelliJIDEA /IntelliJ+ IDEA+ for+NetB eans+Users and Eclipse's users at http://confluence.jetbrains.com/display/ IntelliJIDEA /IntelliJ+ IDEA+ for+Eclipse+Users, which.. .Getting Started with IntelliJ IDEA Exploit IntelliJ IDEA s unique features to rapidly develop web and Java Enterprise applications