blob: 8ffc2af42a9b1bf16f8dcf3b7c7ab7fc377182a4 [file] [log] [blame]
//
// 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.
//
= DevFaqMavenHowToMigrateFromANT
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqMavenHowToMigrateFromANT
:description: Apache NetBeans wiki DevFaqMavenHowToMigrateFromANT
:toc: left
:toc-title:
:syntax: true
The following list was created while converting a simple plugin with less than 20 classes, so the migration steps of large projects might vary. But you should get the basic idea.
* create a new maven based NBM using the New Project”-wizard (to reuse a working configuration)
* copy the folder src and pom.xml to the old project
* in pom.xml
* define a groupId
* set the name from OpenIDE-Module-Name entry in Bundle.properties
* set the artifactid from OpenIDE-Module entry in MANIFEST.MF
* set the version from OpenIDE-Module-Specification-Version entry in MANIFEST.MF
* remove the line with OpenIDE-Module-Specification-Version entry from MANIFEST.MF
* remove the line with OpenIDE-Module entry from MANIFEST.MF
* remove nbproject/genfiles.properties
* remove nbproject/platform.properties
* remove nbproject/build-impl.xml
* remove build.xml
* move manifest.mf to folder src/main/nbm
* move your sources (*.java) to src/main/java (or src/test/java) (GIT is very useful here, the commit history isnt lost)
* move your resources (not *.java) to src/main/resources (or src/test/resources) (especially Bundle.properties)
* add dependencies (the most annoying part)
* foreach dependency entry (code-name-base) in nbproject/project.xml add a dependency via the Add dependency dialog OR add a dependency manually to pom.xml
For example use
[source,xml]
----
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-projectapi</artifactId>
<version>RELEASE73</version>
</dependency>
----
for
[source,xml]
----
<dependency>
<code-name-base>org.netbeans.modules.projectapi</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.46.1</specification-version>
</run-dependency>
</dependency>
----
(!) Note that the dots in the dependency name have to replaced by a dashes
* add test dependenciesFor example use
[source,xml]
----
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-libs-junit4</artifactId>
<version>RELEASE73</version>
<scope>test</scope>
</dependency>
----
for
[source,xml]
----
<test-dependencies>
<test-type>
<name>unit</name>
<test-dependency>
<code-name-base>org.netbeans.libs.junit4</code-name-base>
<compile-dependency/>
</test-dependency>
</test-type>
</test-dependencies>
----
There is still more to do. Like to configure export packages, signing, homepage and so one. Most of these configuration settings defined in the original project.properties have a counterpart in the plugin configuration of the nbm-maven-plugin. See the detailed goal documentation at link:http://mojo.codehaus.org/nbm-maven/nbm-maven-plugin/nbm-mojo.html[http://mojo.codehaus.org/nbm-maven/nbm-maven-plugin/nbm-mojo.html]
Copied from link:http://benkiew.wordpress.com/2013/10/21/how-convert-an-ant-based-netbeans-module-to-a-maven-based-netbeans-module/[http://benkiew.wordpress.com/2013/10/21/how-convert-an-ant-based-netbeans-module-to-a-maven-based-netbeans-module/]. Tested with NB7.4
=== Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from link:http://wiki.netbeans.org/DevFaqMavenHowToMigrateFromANT[http://wiki.netbeans.org/DevFaqMavenHowToMigrateFromANT] ,
that was last modified by NetBeans user Markiewb
on 2013-10-22T19:52:24Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.