Maven - How to make the Castor plugin run on the generated source phase?

I am mavenizing an ant project. One module includes XSD files that are used to generate source files using Castor. Everything works for me if I run:

mvn castor:generate package

However, I cannot get it to run the generation target for my plugin without specifying it on the command line. My xml module section is as follows:

<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>castor-maven-plugin</artifactId>
      <version>1.0</version>
      <configuration>
      </configuration>
      <executions>
        <execution>
          <phase>generate-sources</phase>
          <goals>
            <goal>generate</goal>
          </goals>
        </execution>
      </executions>
</plugin>

I tried a few phase records with no luck. Any idea what I'm doing wrong here? I tested this on Windows XP and Linux using Maven 2 and 3. I tried it with version 1.0 (which I should use) and the 2.0 cast-maven-plugin.

Thanks Tim

+3
1

castor:generate generate-sources, , .

, *.xsd src/main/castor, :

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>castor-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
      <!--schema>src/main/castor/schema.xsd</schema-->
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>generate</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

src/main/castor/castorbuilder.properties, , generate-sources:

$ mvn package [INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Q4169367/ 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- castor-maven-plugin:1.0:generate (default) @ Q4169367 ---
[INFO] Processing /home/pascal/Projects/stackoverflow/Q4169367/src/main/castor/schema.xsd
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ Q4169367 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pascal/Projects/stackoverflow/Q4169367/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Q4169367 ---
[INFO] Compiling 3 source files to /home/pascal/Projects/stackoverflow/Q4169367/target/classes
...

, 1.0 , ( 2.0 ). Maven 3.0.

, , , .

+4

Source: https://habr.com/ru/post/1774619/


All Articles