Projet

Général

Profil

MAY Maven Standalone Setup » Historique » Version 8

Anonyme, 02/10/2014 11:28

1 1 Anonyme
h1. SpeADL MAY Maven SetUp
2
3 2 Anonyme
It is possible to use maven to generate code so that Eclipse is not needed anymore.
4
For example, one possible workflow is to use another IDE and executing <pre>mvn generate-sources</pre> after modifying the speadl file.
5 1 Anonyme
6 2 Anonyme
In order to do that, use the following POM file:
7 1 Anonyme
8
<pre>
9 7 Anonyme
<project ...>
10 1 Anonyme
	<modelVersion>4.0.0</modelVersion>
11
	<groupId>XXX</groupId>
12
	<artifactId>XXX</artifactId>
13
	<version>XXX</version>
14
15
	<properties>
16 7 Anonyme
		<may-lib-version>3.3.0</may-lib-version>
17 2 Anonyme
		<xtext-version>2.6.2</xtext-version>
18 1 Anonyme
		<may-version>3.3.1</may-version>
19
	</properties>
20
21
	<dependencies>
22
		<dependency>
23
			<groupId>fr.irit.smac.lib.may</groupId>
24
			<artifactId>common-components</artifactId>
25
			<version>${may-lib-version}</version>
26
		</dependency>
27
	</dependencies>
28
29 7 Anonyme
	<repositories>
30
		<repository>
31
			<id>fr.irit.smac</id>
32
			<url>http://www.irit.fr/~Victor.Noel/maven-repos/</url>
33
		</repository>
34
	</repositories>
35
36 1 Anonyme
	<build>
37 7 Anonyme
		<!-- This is already present in the default POM -->
38
		<sourceDirectory>src</sourceDirectory>
39
		<resources>
40
			<resource>
41
				<directory>src</directory>
42
				<excludes>
43
					<exclude>**/*.java</exclude>
44
				</excludes>
45
			</resource>
46
		</resources>
47 1 Anonyme
		<plugins>
48 7 Anonyme
			<!-- This is already present in the default POM -->
49 1 Anonyme
			<plugin>
50 7 Anonyme
				<artifactId>maven-compiler-plugin</artifactId>
51
				<version>3.1</version>
52
				<configuration>
53
					<source>1.7</source>
54
					<target>1.7</target>
55
				</configuration>
56
			</plugin>
57
			<!-- This configure the maven to take into account the SpeADL code -->
58
			<plugin>
59 1 Anonyme
				<groupId>org.codehaus.mojo</groupId>
60
				<artifactId>build-helper-maven-plugin</artifactId>
61
				<version>1.8</version>
62
				<executions>
63
					<execution>
64
						<id>add-source</id>
65
						<goals>
66
							<goal>add-source</goal>
67
						</goals>
68
						<configuration>
69
							<sources>
70
								<source>speadl-gen</source>
71
							</sources>
72
						</configuration>
73
					</execution>
74 7 Anonyme
					<!-- The following is only needed so that speadl files are included 
75
						in the generated maven artifact -->
76 1 Anonyme
					<execution>
77
						<id>add-resource</id>
78
						<goals>
79
							<goal>add-resource</goal>
80
						</goals>
81
						<configuration>
82 2 Anonyme
							<resources>
83 1 Anonyme
								<resource>
84 7 Anonyme
									<directory>${project.build.sourceDirectory}</directory>
85 1 Anonyme
									<includes>
86
										<include>**/*.speadl</include>
87
									</includes>
88
								</resource>
89
							</resources>
90
						</configuration>
91
					</execution>
92 2 Anonyme
				</executions>
93
			</plugin>
94 8 Anonyme
			<!-- This is needed cleaning the generated file before regenerating them
95
			      But not when doing a clean -->
96 2 Anonyme
			<plugin>
97
				<groupId>org.apache.maven.plugins</groupId>
98
				<artifactId>maven-clean-plugin</artifactId>
99
				<version>2.5</version>
100
				<executions>
101
					<execution>
102
						<phase>generate-sources</phase>
103
						<goals>
104
							<goal>clean</goal>
105
						</goals>
106
						<configuration>
107
							<excludeDefaultDirectories>true</excludeDefaultDirectories>
108
							<filesets>
109 1 Anonyme
								<fileset>
110 2 Anonyme
									<directory>speadl-gen</directory>
111
								</fileset>
112
							</filesets>
113
						</configuration>
114
					</execution>
115
				</executions>
116
			</plugin>
117 7 Anonyme
			<!-- This is needed for generating the file directly from maven -->
118 2 Anonyme
			<plugin>
119
				<groupId>org.eclipse.xtext</groupId>
120
				<artifactId>xtext-maven-plugin</artifactId>
121
				<version>${xtext-version}</version>
122
				<executions>
123
					<execution>
124
						<goals>
125
							<goal>generate</goal>
126
						</goals>
127
					</execution>
128
				</executions>
129
				<configuration>
130
					<languages>
131
						<language>
132
							<setup>fr.irit.smac.may.speadl.SpeADLStandaloneSetup</setup>
133
							<outputConfigurations>
134
								<outputConfiguration>
135
									<outputDirectory>speadl-gen</outputDirectory>
136
								</outputConfiguration>
137
							</outputConfigurations>
138
						</language>
139
					</languages>
140
				</configuration>
141
				<dependencies>
142
					<dependency>
143
						<groupId>fr.irit.smac.may</groupId>
144
						<artifactId>fr.irit.smac.may.speadl</artifactId>
145
						<version>${may-version}</version>
146
					</dependency>
147
				</dependencies>
148 1 Anonyme
			</plugin>
149
		</plugins>
150
	</build>
151
</project>
152
</pre>
153 3 Anonyme
154 5 Anonyme
h2. Possible Issues and Resolutions
155 3 Anonyme
156 6 Anonyme
h3. Errors in the POM file
157
158 5 Anonyme
If the POM file contains the following errors in Eclipse:
159 3 Anonyme
160 5 Anonyme
 Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-clean-plugin:2.5:clean (execution: default, phase: generate-sources)
161 1 Anonyme
162 5 Anonyme
and
163 1 Anonyme
164 5 Anonyme
 Plugin execution not covered by lifecycle configuration: org.eclipse.xtext:xtext-maven-plugin:2.6.2:generate (execution: default, phase: generate-sources)
165 1 Anonyme
166 5 Anonyme
When hovering on the error, choose the following quickfix:
167
168
 Permanently mark goal clean in pom.xml as ignored as ignored in Eclipse build.
169
170
and
171
172
 Permanently mark goal generate in pom.xml as ignored as ignored in Eclipse build.
173
174
This will prevent the Maven plugin in Eclipse to generate the source code while Eclipse also does it internally.