summaryrefslogtreecommitdiffstats
path: root/lib/redmine/subclass_factory.rb
blob: 48724b8b400b0656764687ed0ef6f7c25dbf071c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Redmine - project management software
# Copyright (C) 2006-2015  Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

module Redmine
  module SubclassFactory
    def self.included(base) 
      base.extend ClassMethods
    end 

    module ClassMethods
      def get_subclass(class_name)
        klass = nil
        begin
          klass = class_name.to_s.classify.constantize
        rescue
          # invalid class name
        end
        unless subclasses.include? klass
          klass = nil
        end
        klass
      end

      # Returns an instance of the given subclass name
      def new_subclass_instance(class_name, *args)
        klass = get_subclass(class_name)
        if klass
          klass.new(*args)
        end
      end
    end
  end
end
kground-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
---
title: Creating a Project in IntelliJ
order: 120
layout: page
---

[[getting-started.idea]]
= Creating a Project with IntelliJ IDEA

With both Community Edition and Ultimate Edition, you can create a Vaadin application most easily with a Maven archetype and deploy it to a server with a Maven run/debug configuration.

[[getting-started.idea.maven]]
== Creating a Maven Project

You can choose to create a Maven project in IntelliJ IDEA. You will not have the
application server integration, but can deploy the application to an application
server using a run/debug configuration.

. Select [menuchoice]#New Project#

. In the [guilabel]#New Project# window, select [menuchoice]#Maven#
//<?dbfo-need height="8cm" ?>

. Select the Java SDK to be used for the project. Vaadin requires at least Java 8.

. Check [guilabel]#Create from archetype# checkbox

. If the Vaadin archetype is not in the list, click [guibutton]#Add archetype#,
enter [guilabel]#GroupId# [literal]#++com.vaadin++#, [guilabel]#ArtifactId#
[literal]#++vaadin-archetype-application++#, and [guilabel]#Version#
[literal]#++LATEST++# (or a specific version number).

+
Click [guibutton]#OK# in the dialog.
//<?dbfo-need height="8cm" ?>

. Select the archetype
+
image::img/idea-maven-newproject-1.png[scaledwidth=100%]
+
Click [guibutton]#Next#.
//<?dbfo-need height="6cm" ?>

. Give a Maven [guilabel]#GroupID#, [guilabel]#ArtifactID#, and a
[guilabel]#Version# for the project, or use the defaults.

. Review the general Maven settings and settings for the new project.
You may need to override the settings, especially if you are creating a Maven project for the first time.

. Finish the wizard.
//<?dbfo-need height="8cm" ?>

Creating the Maven project takes some time as Maven fetches the dependencies.
Once done, the project is created and the Maven POM is opened in the editor.

Fort more detailed instructions, refer to https://www.jetbrains.com/help/idea/
[[getting-started.idea.maven.compiling]]
=== Compiling the Project

To compile a Vaadin application using Maven, you can define a run/debug
configuration to execute a goal such as [literal]#++package++# to build the
deployable WAR package. It will also compile the widget set and theme, if
necessary. See
<<dummy/../../../framework/getting-started/getting-started-maven#getting-started.maven.compiling,"Compiling
and Running the Application">> for more details.

Compilation is included in the following instructions for deploying the
application.


[[getting-started.idea.maven.deploying]]
=== Deploying to a Server

There exists Maven plugins for deploying to various application servers. For
example, to deploy to Apache Tomcat, you can to configure the
[literal]#++tomcat-maven-plugin++# and then execute the
[literal]#++tomcat:deploy++# goal. See the documentation of the plugin that you
use for more details. If no Maven plugin exists for a particular server, you can
always use some lower-level method to deploy the application, such as running an
Ant task.

In the following, we create a run/debug configuration to build, deploy, and
launch a Vaadin Maven application on the light-weight Jetty web server.

. Select "Run > Edit Configurations".

. Click [guibutton]#+# and select [guilabel]#Maven# to create a new Maven run/debug configuration.

. Enter a [guilabel]#Name# for the run configuration.
For the [guilabel]#Command line#, enter `package jetty:run` to first compile and package the project, and then launch Jetty to run it.

+
Click [guibutton]#OK#.

. Select the run configuration in the toolbar and click the [guibutton]#Run#
button beside it.


Compiling the project takes some time on the first time, as it compiles the
widget set and theme. Once the run console pane informs that Jetty Server has
been started, you can open the browser at the default URL
http://localhost:8080/.