Class: Mvnizer::Command::NewProject

Inherits:
Object
  • Object
show all
Includes:
Mvnizer::Configuration, TaskHelper
Defined in:
lib/mvnizer/commands/new_project.rb

Direct Known Subclasses

NewWarProject

Constant Summary

Constants included from TaskHelper

TaskHelper::TEMPLATE_DIR

Instance Method Summary collapse

Methods included from TaskHelper

#add_dependency, #create_dir, #generate_file

Methods included from Mvnizer::Configuration

#conf

Instance Method Details

#get_dependenciesObject

Returns the list of dependencies to be added for this type of project. Override this method if extra dependencies are needed.



29
30
31
# File 'lib/mvnizer/commands/new_project.rb', line 29

def get_dependencies
  []
end

#run(project) ⇒ Object

Creates the Maven project structure, and creates the pom file from the options



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mvnizer/commands/new_project.rb', line 9

def run(project)

  create_dir("#{project.artifact_id}/src/main/java",
             "#{project.artifact_id}/src/test/java")

  coordinate_parser = CoordinateParser.new
  get_dependencies.each { |d| project.add_dependency(coordinate_parser.parse_scoped_coordinates(d)) }

  generate_file(File.join(TEMPLATE_DIR, "pom.xml.erb"),
                "#{project.artifact_id}/pom.xml",
                project)
  generate_file(File.join(TEMPLATE_DIR, "gitignore.erb"),
                "#{project.artifact_id}/.gitignore",
                project)


end