blob: 9536cca4fbc8184e843d878cfebb54eca8180129 [file] [log] [blame]
------
Creating a Simple Project
------
------
25 Feb 2009
------
~~Licensed to the Apache Software Foundation (ASF) under one
~~or more contributor license agreements. See the NOTICE file
~~distributed with this work for additional information
~~regarding copyright ownership. The ASF licenses this file
~~to you under the Apache License, Version 2.0 (the
~~"License"); you may not use this file except in compliance
~~with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~Unless required by applicable law or agreed to in writing,
~~software distributed under the License is distributed on an
~~"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~KIND, either express or implied. See the License for the
~~specific language governing permissions and limitations
~~under the License.
Creating a Simple Project
Before you start this procedure, you must have all {{{../installation/index.html} Pre-requisites}} in place and have
successfully completed all steps in the previous section entitled Installing and Verifying NPanday .NET Build Tool.
We will use the Maven Archetype Plugin to generate a skeleton project. It will be created as a subdirectory of the
current working directory in the command shell.
Execute the following command to create a C# project:
~~TODO: how can we get the archetypes into a catalog so they can be easily viewed?
----
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-dotnet-simple -DarchetypeGroupId=org.apache.npanday \
-DarchetypeVersion=[version]
----
When prompted, select the co-ordinates for the project that you wish to use, eg:
* group ID = <<<com.example>>>
* artifact ID = <<<Example.Project>>>
* version = <<<1.0-SNAPSHOT>>>
[]
The command creates the project in the Example.Project directory, which will now contain the following:
+------+
.
|-- src
| `-- main
| `-- csharp
| `-- Sample
| `-- MyApp.cs
| `-- resources
| `-- test
| `-- csharp
`- pom.xml
+------+
From inside the Solution directory (<<<Example.Project>>>), execute the following command to build and install the
Example.Project DLL files into your repository:
<<<mvn install>>>
The <<<mvn install>>> command typically puts artifacts (installs them) into the repository here,
<<<C:\\Users\\[username]\\.m2\\repository>>>.
The sample project contains NUnit tests. If the build fails on <<<nunit-console>>>, make sure you have NUnit 2.2+
installed and located in the PATH.
You can clean up the target directory and download dependencies by executing:
<<<mvn clean>>>
* Creating other types of projects
Other types of template projects are available. To use them instead, change the <<<archetypeArtifactId>>> option to
one of the following:
* <<<maven-archetype-dotnet-simple>>> - simple C# project with unit tests in the Maven directory layout
* <<<maven-archetype-vb-simple>>> - simple Visual Basic project with unit tests in the Maven directory layout
* <<<maven-archetype-netexecutable>>> - simple project for creating a console executable
[]