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