Projet

Général

Profil

MAY Project Setup » Historique » Version 21

Anonyme, 09/11/2011 14:42

1 1 Anonyme
*Draft version...*
2
3
h1. SpeADL MAY Project SetUp
4
5 18 Anonyme
h2. A classic JAVA project to start with...
6
7 1 Anonyme
First, create a java project, choose a name, and click finish. Add the SpeADL Nature to the project : right click on the project / Configure / Add SpeADL Nature.
8
_This is necessary in order to..._
9
10 4 Anonyme
Then, create a new file with the speadl extension within the src folder. Eclipse will ask you if you want to add Xtext nature to the project, click yes.
11 3 Anonyme
12 2 Anonyme
!https://wwwsecu.irit.fr/redmine/attachments/download/336/add_xtext_nature_confirm.jpg!
13 5 Anonyme
14 19 Anonyme
h2. Maven convertion
15
16 5 Anonyme
The next step is to convert your project into a Maven project. To do this, right click on your project / Configure / Convert to Maven Project.
17
You will be asked to create a new POM file. Just click finish and edit it manually. A good starting pom.xml for a new project is the following:
18
19 6 Anonyme
<pre>
20
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
	<modelVersion>4.0.0</modelVersion>
23
	<groupId>XXX</groupId>
24
	<artifactId>XXX</artifactId>
25
	<version>0.0.1-SNAPSHOT</version>
26
	<dependencies>
27
		<dependency>
28
			<groupId>fr.irit.smac.may.lib</groupId>
29
			<artifactId>common-components</artifactId>
30
			<version>0.0.3-SNAPSHOT</version>
31
			<type>jar</type>
32
			<scope>compile</scope>
33
		</dependency>
34
	</dependencies>
35
	<repositories>
36
		<repository>
37
			<id>fr.irit.smac</id>
38
			<url>http://www.irit.fr/~Victor.Noel/maven-repos/</url>
39
		</repository>
40
	</repositories>
41
	<build>
42
		<plugins>
43
			<plugin>
44
				<groupId>org.codehaus.mojo</groupId>
45
				<artifactId>build-helper-maven-plugin</artifactId>
46
				<version>1.7</version>
47
				<executions>
48
					<execution>
49
						<id>add-source</id>
50
						<phase>generate-sources</phase>
51
						<goals>
52
							<goal>add-source</goal>
53
						</goals>
54
						<configuration>
55
							<sources>
56
								<source>src-gen</source>
57
							</sources>
58
						</configuration>
59
					</execution>
60
				</executions>
61
			</plugin>
62
		</plugins>
63
	</build>
64
</project>
65
</pre>
66 5 Anonyme
67 8 Anonyme
h1. Possible issues and resolutions
68
69 10 Anonyme
h2. Project configuration is not up-to-date
70
71 5 Anonyme
You may get an error message saying your project configuration is out of date with your new pom.xml
72
Update it : right click on your project / Maven / Update Project Configuration...
73 7 Anonyme
74 1 Anonyme
!https://wwwsecu.irit.fr/redmine/attachments/download/337/update_project_conf.jpg!
75 12 Anonyme
76
h2. Proxy and Maven
77 8 Anonyme
78 20 Anonyme
In case you are behind a proxy, Maven may not be able to resolve dependencies.
79
You might get an error message like "failed to read arfifact descriptor" and "could not calculate build plan".
80 21 Anonyme
81
!https://wwwsecu.irit.fr/redmine/attachments/download/340/proxy_issue.jpg!
82
83 20 Anonyme
You have to configure Maven.
84 9 Anonyme
Window / Preferences / Maven / User Settings
85
86
!https://wwwsecu.irit.fr/redmine/attachments/download/338/maven_settings_proxy.jpg!
87
88 15 Anonyme
The settings.xml file located in the indicated directory usually doesn't even exit. Go to this directory and create an empty settings.xml file.
89 9 Anonyme
Edit it like this:
90
91
<pre>
92
<settings>
93
  <proxies>
94
   <proxy>
95
      <active>true</active>
96
      <protocol>http</protocol>
97
      <host>XXX</host>
98
      <port>YYY</port>
99
    </proxy>
100
  </proxies>
101
</settings>
102
</pre>
103
104
Replace XXX by your proxy URL and YYY by the port used. Ask your administrator if you don't know it.
105 17 Anonyme
When it's done, click Browse and select your settings.xml file, then click Update Settings.
106
This may take some take before the errors disapear, Maven is resolving dependencies and updating the project.