我正在尝试构建一个在WebLogic上运行的项目(打包为耳朵)。但是,虽然构建(mvn clean包)成功,但ear文件只包含一个META-INF文件夹,其中包含很少的文件。
我不熟悉项目(或EJB),但它看起来像一个EJB项目(我看到了EJBHome,EJBObject,EJBLocalObject)。
不确定从哪里开始 - 我已经在线搜索过其他帖子,但是没有多少提出来。即使是正确方向的一点也很有用。
构建日志:
C:\Users\LevineJ\Development\default-workspace\reportservice>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building reportservice 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ reportservice ---
[INFO] Deleting C:\Users\LevineJ\Development\default-workspace\reportservice\target
[INFO]
[INFO] --- maven-ear-plugin:2.8:generate-application-xml (default-generate-application-xml) @ reportservice ---
[INFO] Generating application.xml
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ reportservice ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e.
build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\LevineJ\Development\default-workspace\reportservice\src\main\resources
[INFO]
[INFO] --- maven-ear-plugin:2.8:ear (default-ear) @ reportservice ---
[INFO] Could not find manifest file: C:\Users\LevineJ\Development\default-workspace\reportservice\target\reportservice-0.0.1-SNAPSHOT\META-INF\MANIFEST.MF - Generating one
[INFO] Building jar: C:\Users\LevineJ\Development\default-workspace\reportservice\target\reportservice-0.0.1-SNAPSHOT.ear
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.380 s
[INFO] Finished at: 2015-02-03T19:55:50-05:00
[INFO] Final Memory: 5M/244M
[INFO] ------------------------------------------------------------------------
产生的EAR:
产生的pom.xml(内置耳内)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>reportservice</groupId>
<artifactId>reportservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
</project>
来自 的 pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>reportservice</groupId>
<artifactId>reportservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://artifactory.gxsonline.net/libs-release</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://artifactory.gxsonline.net/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://artifactory.gxsonline.net/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://artifactory.gxsonline.net/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\src\main\java</sourceDirectory>
<scriptSourceDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\src\test\java</testSourceDirectory>
<outputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\classes</outputDirectory>
<testOutputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\test-classes</testOutputDirectory>
<resources>
<resource>
<directory>C:\Users\LevineJ\Development\default-workspace\reportservice\src\main\resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>C:\Users\LevineJ\Development\default-workspace\reportservice\src\test\resources</directory>
</testResource>
</testResources>
<directory>C:\Users\LevineJ\Development\default-workspace\reportservice\target</directory>
<finalName>reportservice-0.0.1-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>default-ear</id>
<phase>package</phase>
<goals>
<goal>ear</goal>
</goals>
</execution>
<execution>
<id>default-generate-application-xml</id>
<phase>generate-resources</phase>
<goals>
<goal>generate-application-xml</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<outputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<outputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>C:\Users\LevineJ\Development\default-workspace\reportservice\target\site</outputDirectory>
</reporting>
</project>
答案 0 :(得分:0)
我认为问题在于你的ejb包装罐没有依赖性。
查看以下GitHub存储库: https://github.com/StefanHeimberg/stackoverflow-1134894
在那里你可以看到一个简单的例子,你应该如何使用maven打包java ee应用程序。
耳朵项目的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example.myproject</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>myproject-application</artifactId>
<packaging>ear</packaging>
<name>MyProject - Application</name>
<dependencies>
<dependency>
<groupId>com.example.myproject</groupId>
<artifactId>myproject-web</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>com.example.myproject</groupId>
<artifactId>myproject-business</artifactId>
<type>ejb</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<webModule>
<groupId>com.example.myproject</groupId>
<artifactId>myproject-web</artifactId>
</webModule>
<ejbModule>
<groupId>com.example.myproject</groupId>
<artifactId>myproject-business</artifactId>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
父pom.xml中的属性:
<maven.ear.duplicateArtifactsBreakTheBuild>true</maven.ear.duplicateArtifactsBreakTheBuild>
<maven-ear-plugin.version>2.10</maven-ear-plugin.version>
父pom.xml部分中的EAR插件配置:
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>${maven-ear-plugin.version}</version>
<configuration>
<fileNameMapping>no-version</fileNameMapping>
<version>7</version>
<!-- Die EAR Spezifikation sieht den *.ear/lib ordner als standard vor.
dieser muss im application.xml nicht zusätzlich aufgelistet werden. -->
<defaultLibBundleDir>lib</defaultLibBundleDir>
<libraryDirectoryMode>NONE</libraryDirectoryMode>
</configuration>
</plugin>