How to change the location of ejb-jar.xml in my maven project?

When creating my EJB project using maven, maven expects ejb-jar.xml to be in META-INF /. But; I need to be able to put it in the A / META-INF directory.

The maven-ejb-plugin does not seem to provide a parameter to indicate where ejb-jar.xml is.

Can you point me in the right direction?

+3
source share
4 answers

, maven-ejb-plugin , , , META-INF/ejb-jar.xml ( EjbMojo), EJB 2.X( ).

, maven-antrun-plugin , directoryA (, directoryA , src/main/resources, target/classes) (.. target/classes) , - :

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <phase>prepare-package</phase>
      <configuration>
        <tasks>
          <copy todir="${project.build.outputDirectory}">
            <fileset dir="${project.build.outputDirectory}/directoryA"/> 
          </copy>
          <delete dir="${project.build.outputDirectory}/directoryA"/>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>

, .

+2

ejb-jar.xml build.outputdirectory/META-INF, pligin private static final String EJB_JAR_XML = "META-INF/ejb-jar.xml"; rejiured ejb-xml ....

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<executions>
    <execution>
        <id>copy-resources</id>
        <phase>validate</phase>
        <goals>
            <goal>copy-resources</goal>
        </goals>
        <configuration>
            <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
            <resources>
                <resource>
                    <directory>${project.build.sourceDirectory}/META-INF</directory>
                </resource>
            </resources>
        </configuration>
    </execution>
</executions>

+1

, "" POM ( java/main/resources):

<build>
    <resources>
        <resource>
            <directory>${project.basedir}/directoryA</directory>
        </resource>
    </resources>
...
</build>
+1

"outputDirectory" (http://maven.apache.org/plugins/maven-ejb-plugin/ejb-mojo.html#outputDirectory)? , antrun, ; config ejb- (. ). , , , ejb-jar.xml ?

-1

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


All Articles