Maven and Erlide
From Erlang Community
| Revision as of 11:02, 6 October 2006 (edit) 213.171.204.166 (Talk) ← Previous diff |
Revision as of 11:05, 6 October 2006 (edit) (undo) 213.171.204.166 (Talk) (link to first part) Next diff → |
||
| Line 1: | Line 1: | ||
| + | ====Notice==== | ||
| + | '''This is a two-part article''' | ||
| + | |||
| + | [[Maven_and_Erlang|The first part]] deals with installing Maven and maven-erlang plugin for Maven | ||
| + | |||
| + | This part will deal with using Maven with Erlide | ||
| + | |||
| + | |||
| ===How do you marry Maven and Erlide?=== | ===How do you marry Maven and Erlide?=== | ||
| Line 193: | Line 201: | ||
| You need Erlide version 0.3.26 or higher for Erlide to work with Maven | You need Erlide version 0.3.26 or higher for Erlide to work with Maven | ||
| + | |||
| + | |||
| + | [[Category:HowTo]] | ||
Revision as of 11:05, 6 October 2006
Contents |
Notice
This is a two-part article
The first part deals with installing Maven and maven-erlang plugin for Maven
This part will deal with using Maven with Erlide
How do you marry Maven and Erlide?
Briefly, you would have to do the following:
- Teach Maven how to create Eclipse projects
- Create a project using erlang-plugin
- Create an Eclipse project using Maven
- Edit the project to make it Erlide-aware
- Open the project in Eclipse
- Change Erlide's paths
All is very simple though rather lengthy.
Teach Maven how to create Eclipse projects
Attention! Read the following steps carefully, as there are some caveats in installing maven-eclipse-plugin.
1. Maven will not be able to install maven-eclipse-plugin because it doesn't have access to developer repositories.
In order to make Maven aware of these repositories, locate and open MAVEN_INSTALL_DIR/conf/settings.xml
Locate the following section:
<profiles> </profiles>
Add the following:
<profiles>
<profile>
<id>apache</id>
<repositories>
<repository>
<id>apache.org</id>
<name>Maven Snapshots</name>
<url>http://people.apache.org/maven-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.org</id>
<name>Maven Plugin Snapshots</name>
<url>http://people.apache.org/maven-snapshot-repository</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>codehaus</id>
<repositories>
<repository>
<id>codehaus.org</id>
<name>CodeHaus Snapshots</name>
<url>http://snapshots.repository.codehaus.org</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codehaus.org</id>
<name>CodeHaus Plugin Snapshots</name>
<url>http://snapshots.repository.codehaus.org</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Locate the following section:
<activeProfiles> </activeProfiles>
Add the follwoing:
<activeProfiles> <activeProfile>apache</activeProfile> <activeProfile>codehaus</activeProfile> </activeProfiles>
Save the file
Install maven-eclipse-plugin
1. Create a floder for the plugin
2. SVN checkout from http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin
3. Type mvn install
4. Maven will download and install any additional dependencies
5. After onstallation run the following:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
Create a project
The follwoing assumes that you've repeated all the steps from the first part of this tutorial and that you have mvncreate.bat in your path
1. Go into a directory of your choosing and type mvncreate Test Core
2. In the same console cd Core
3. In the same console mvn eclipse:eclipse
4. Maven will create a file called .project which contains a stub for Eclipse:
<projectDescription> <name>Core</name> <comment/> <projects/> <buildSpec/> <natures/> </projectDescription>
5. We need to change buildspec and natures to make the project aware of Erlide and Maven:
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>Core</name> <comment></comment> <projects> </projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/.externalToolBuilders/Compile.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.erlide.core.erlbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.erlide.core.erlnature</nature>
</natures>
</projectDescription>
Using the projext in Eclipse
1. Run Eclipse
2. File -> Import -> General -> Existing Projects Into Workspace
3. Select the Core directory
4. Finish
Right-click the project -> Properties
- Erlang Properties
- Build output: target/ebin
- Source: src/main/erlang;src/test/erlang
- Include: src/include
Here you can also select Maven as a default builder for the project (Builders -> New -> m2 Build) or you can set it as an external tool (Run -> External Tools -> External Tools... -> m2 build -> New). In both cases settings are the same:
1. Name: I prefer to name it according to goals I'm trying to accomplish - one of: compile, test, install, deploy
2. Base directory: ${workspace_loc:/Workspace} (click Browse workspace -> current project)
3. Goals: one of Mavens goals: compile, test, install, deploy (you may also select them from Goals... -> Lifecycle Phases)
All is done and installed
Note on Erlide version
You need Erlide version 0.3.26 or higher for Erlide to work with Maven

Digg It
Del.icio.us
Reddit
Facebook
Stumble Upon
Technorati

