MAY Maven Standalone Setup » Historique » Version 7
Anonyme, 02/10/2014 11:25
| 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 | 7 | Anonyme | <!-- This is needed cleaning the generated file before regenerating them --> |
| 95 | 2 | Anonyme | <plugin> |
| 96 | <groupId>org.apache.maven.plugins</groupId> |
||
| 97 | <artifactId>maven-clean-plugin</artifactId> |
||
| 98 | <version>2.5</version> |
||
| 99 | <executions> |
||
| 100 | <execution> |
||
| 101 | <phase>generate-sources</phase> |
||
| 102 | <goals> |
||
| 103 | <goal>clean</goal> |
||
| 104 | </goals> |
||
| 105 | <configuration> |
||
| 106 | <excludeDefaultDirectories>true</excludeDefaultDirectories> |
||
| 107 | <filesets> |
||
| 108 | 1 | Anonyme | <fileset> |
| 109 | 2 | Anonyme | <directory>speadl-gen</directory> |
| 110 | </fileset> |
||
| 111 | </filesets> |
||
| 112 | </configuration> |
||
| 113 | </execution> |
||
| 114 | </executions> |
||
| 115 | </plugin> |
||
| 116 | 7 | Anonyme | <!-- This is needed for generating the file directly from maven --> |
| 117 | 2 | Anonyme | <plugin> |
| 118 | <groupId>org.eclipse.xtext</groupId> |
||
| 119 | <artifactId>xtext-maven-plugin</artifactId> |
||
| 120 | <version>${xtext-version}</version> |
||
| 121 | <executions> |
||
| 122 | <execution> |
||
| 123 | <goals> |
||
| 124 | <goal>generate</goal> |
||
| 125 | </goals> |
||
| 126 | </execution> |
||
| 127 | </executions> |
||
| 128 | <configuration> |
||
| 129 | <languages> |
||
| 130 | <language> |
||
| 131 | <setup>fr.irit.smac.may.speadl.SpeADLStandaloneSetup</setup> |
||
| 132 | <outputConfigurations> |
||
| 133 | <outputConfiguration> |
||
| 134 | <outputDirectory>speadl-gen</outputDirectory> |
||
| 135 | </outputConfiguration> |
||
| 136 | </outputConfigurations> |
||
| 137 | </language> |
||
| 138 | </languages> |
||
| 139 | </configuration> |
||
| 140 | <dependencies> |
||
| 141 | <dependency> |
||
| 142 | <groupId>fr.irit.smac.may</groupId> |
||
| 143 | <artifactId>fr.irit.smac.may.speadl</artifactId> |
||
| 144 | <version>${may-version}</version> |
||
| 145 | </dependency> |
||
| 146 | </dependencies> |
||
| 147 | 1 | Anonyme | </plugin> |
| 148 | </plugins> |
||
| 149 | </build> |
||
| 150 | </project> |
||
| 151 | </pre> |
||
| 152 | 3 | Anonyme | |
| 153 | 5 | Anonyme | h2. Possible Issues and Resolutions |
| 154 | 3 | Anonyme | |
| 155 | 6 | Anonyme | h3. Errors in the POM file |
| 156 | |||
| 157 | 5 | Anonyme | If the POM file contains the following errors in Eclipse: |
| 158 | 3 | Anonyme | |
| 159 | 5 | Anonyme | Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-clean-plugin:2.5:clean (execution: default, phase: generate-sources) |
| 160 | 1 | Anonyme | |
| 161 | 5 | Anonyme | and |
| 162 | 1 | Anonyme | |
| 163 | 5 | Anonyme | Plugin execution not covered by lifecycle configuration: org.eclipse.xtext:xtext-maven-plugin:2.6.2:generate (execution: default, phase: generate-sources) |
| 164 | 1 | Anonyme | |
| 165 | 5 | Anonyme | When hovering on the error, choose the following quickfix: |
| 166 | |||
| 167 | Permanently mark goal clean in pom.xml as ignored as ignored in Eclipse build. |
||
| 168 | |||
| 169 | and |
||
| 170 | |||
| 171 | Permanently mark goal generate in pom.xml as ignored as ignored in Eclipse build. |
||
| 172 | |||
| 173 | This will prevent the Maven plugin in Eclipse to generate the source code while Eclipse also does it internally. |