JBoss Fuse OSGi envers not working - jboss
I want to use hibernate envers auditing for generating aud tables and deploy it to Jboss fuse OSGi Karaf container.
Added #Audited notation in entity class and hibernate-envers jar in my pom file.
Here is my pom.xml file,
<parent>
<groupId>fuse-examples</groupId>
<artifactId>fuse-spring-hibernate-module</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>fuse-blueprint-hibernate</artifactId>
<packaging>bundle</packaging>
<name>Business Service</name>
<properties>
<camel-version>1.5.0</camel-version>
<maven-bundle-plugin>2.4.0</maven-bundle-plugin>
<javax.persistence>2.0.0</javax.persistence>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${javax.persistence}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>business-service</Bundle-SymbolicName>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
<Import-Package>
org.hibernate.envers,
javax.sql,
javax.persistence,
org.hibernate.proxy,
javassist.util.proxy,
org.slf4j
</Import-Package>
<Include-Resource>src/main/resources</Include-Resource>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
If i removed org.hibernate.envers from pom.xml, the table got created but _aud tables not generated.
What settings i missed?
Anything settings missed in osgi container or pom.xml?
Or anything want to setup in blueprint xml?
Help me.
After some researched did about JBoss Fuse Karaf based OSGi container, I completed the task.
Actually we building the bundle for deploying it to OSGi container, we should set some settings. First of all we should tell what are the packages load by OSGi container and what are the packages by embedding into bundle.
Bundle manifest file will define this. That is the root settings for every bundle.
In hardcore frameworks or dependencies can embed within the bundle.
My mistake was i just declared org.hibernate.envers for using hibernate envers.
<Import-Package>
org.hibernate.envers,
javax.sql,
javax.persistence,
org.hibernate.proxy,
javassist.util.proxy,
org.slf4j
</Import-Package>
Most of times classloading issues may occur, If this occurs resources may null.
The solution is we should import everything envers imports.
Here i pasted my manifest file, It is working fine.
Manifest-Version: 1.0
Bnd-LastModified: 1481971039345
Build-Jdk: 1.8.0_112
Built-By: Smile
Bundle-Activator: com.fuse.hibernate.services.OsgiBundleActiva
tor
Bundle-Blueprint: OSGI-INF/blueprint/blueprint.xml
Bundle-ClassPath: .,hibernate-envers-4.2.22.Final-redhat-1.jar
Bundle-ManifestVersion: 2
Bundle-Name: FUSE-HIBERNATE
Bundle-SymbolicName: fuse-hibernate
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: <Exported Packages>
Export-Service: com.fuse.repository.CustomRepository
Import-Package: org.hibernate.annotations;version="[4.2,5)",org.hibernat
e.annotations.common.reflection;version="[4.0,5)",javax.persistence;ver
sion="[2.0,3)",org.hibernate.proxy;version="[4.2,5)",javassist.util.pro
xy;version="[3.18,4)",org.slf4j;version="[1.7,2)",javax.management,java
x.naming,javax.persistence.metamodel;version="[2.0,3)",javax.transactio
n;version="[1.1,2)",org.apache.commons.beanutils;version="[1.8,2)",org.
apache.commons.lang3;version="[3.0,4)",org.apache.tools.ant,org.dom4j,o
rg.dom4j.io,org.dom4j.tree,org.hibernate;version="[4.2,5)",org.hibernat
e.action.spi;version="[4.2,5)",org.hibernate.cache;version="[4.2,5)",or
g.hibernate.cfg;version="[4.2,5)",org.hibernate.collection.spi;version=
"[4.2,5)",org.hibernate.criterion;version="[4.2,5)",org.hibernate.diale
ct;version="[4.2,5)",org.hibernate.engine.jdbc.spi;version="[4.2,5)",or
g.hibernate.engine.loading.internal,org.hibernate.engine.spi;version="[
4.2,5)",org.hibernate.engine.transaction.spi;version="[4.2,5)",org.hibe
rnate.event.service.spi;version="[4.2,5)",org.hibernate.event.spi;versi
on="[4.2,5)",org.hibernate.id;version="[4.2,5)",org.hibernate.id.enhanc
ed;version="[4.2,5)",org.hibernate.integrator.spi;version="[4.2,5)",org
.hibernate.internal,org.hibernate.internal.util;version="[4.2,5)",org.h
ibernate.internal.util.collections,org.hibernate.internal.util.config,o
rg.hibernate.internal.util.xml,org.hibernate.jdbc;version="[4.2,5)",org
.hibernate.mapping;version="[4.2,5)",org.hibernate.metamodel.source;ver
sion="[4.2,5)",org.hibernate.metamodel.spi;version="[4.2,5)",org.hibern
ate.persister.collection;version="[4.2,5)",org.hibernate.persister.enti
ty;version="[4.2,5)",org.hibernate.property;version="[4.2,5)",org.hiber
nate.service;version="[4.2,5)",org.hibernate.service.classloading.spi;v
ersion="[4.2,5)",org.hibernate.service.jdbc.dialect.internal,org.hibern
ate.service.jndi;version="[4.2,5)",org.hibernate.service.spi;version="[
4.2,5)",org.hibernate.sql;version="[4.2,5)",org.hibernate.tool.hbm2ddl;
version="[4.2,5)",org.hibernate.type;version="[4.2,5)",org.hibernate.us
ertype;version="[4.2,5)",org.jboss.logging;version="[3.1,4)",org.joda.t
ime;version="[2.9,3)",org.osgi.framework;version="[1.6,2)",org.osgi.ser
vice.blueprint;version="[1.0.0,2.0.0)",org.w3c.dom,javax.sql
Meta-Persistence: META-INF/persistence.xml
We can use Include-Resource tag for including hibernate as a resource and make sure to add this in bundle class path. It should work.
Related
spring-boot-maven-plugin include other projects from workspace
I have a spring STS project which depends on two other projects in the same workspace. I have included them in my pom.xml but when I build jar they are excluded from the generated jar.Could you please let me know how to include these two dependent projects in the build. I have below entries in pom.xml <dependencies> <dependency> <groupId>org.acord.standards.life</groupId> <artifactId>txlife</artifactId> <version>2.37.00</version> </dependency> <dependency> <groupId>com.xxx.service.query</groupId> <artifactId>queryutil</artifactId> <version>1.0</version> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.acord.standards.life</groupId> <artifactId>txlife</artifactId> <version>2.37.00</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.xxx.service.query</groupId> <artifactId>queryutil</artifactId> <version>1.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <configuration> <attach>true</attach> <!-- <includes> <include> <groupId>org.acord.standards.life</groupId> <artifactId>txlife</artifactId> <version>2.37.00</version> <classifier>2.37.00</classifier> </include> <include> <groupId>com.xxx.service.query</groupId> <artifactId>queryutil</artifactId> <version>1.0</version> <classifier>1.0</classifier> </include> </includes> --> </configuration> </plugin> </plugins> </build>
I solve this problem following this documentation from Spring.io. An alternative approach is you run Maven Install for each dependency project and, after it, set them in your pom.xml (in your main project). For example, I have a main spring project called Alna Rest that depends of others particular spring projects how Alna Data and Alna Service, then, in my Alna Rest project my pom.xml has this: <dependency> <groupId>com.alna.data</groupId> <artifactId>alna-data</artifactId> <version>0.0.1</version> </dependency> <dependency> <groupId>com.alna.service</groupId> <artifactId>alna-service</artifactId> <version>0.0.1</version> </dependency> After it I can run Maven Install in my Alna Rest project that the Spring Boot Maven Plugin build an executable jar with all projects dependencies. Well, this works for me. But I don't know if it is the better approach for build a project that requires many othes spring boot projects. Then I recommend you search more about this.
why am I able to create wsdl when I took away pluginManagement?
My entire pom.xml is below. With this pom I get this error in Eclipse "Plugin execution not covered by lifecycle configuration: org.apache.cxf:cxf-java2ws-plugin:3.1.8:java2ws (execution: process-classes, phase: process-classes)". Nevertheless, it does work properly. I mean, if I "mvn clean package install" I get the output wsdl file desired. If I added pluginManagement, the error in Eclipse desapears but I don't get the wsdl file desired neither I get an error in my console. The two closest discussions I found about it was "Publishing wsdl java M2E plugin execution not covered" and "How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds" but I didn't understand them. As far as I can see, the idea is to change to take advantage of "<lifecycleMappingMetadata>...<action><execute/>". My straight question is: why does my below pom works when I take away pluginManagement? I guess, not sure, that I am missing a basic knowledgement about the relantionship between pluginManagement and execution. The most relevant part from my question is not what is worng with Eclipse (I found few people saying to ignore it). I have been using pluginManagement for while but I have never wondering exactly what extra features it adds to my pom. Since now it is failing with java2ws, I am really interested to understand if there is any extra configuration I should add in my pom in order to get it up and running with pluginManagement and goal>java2ws. <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>grp</groupId> <artifactId>art</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>art Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <jdk.version>1.8</jdk.version> <cxf.version>3.1.8</cxf.version> <spring.version>4.3.4.RELEASE</spring.version> <!-- <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> --> </properties> <dependencies> <!-- Spring dependencies --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <!-- Apache cxf dependencies --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> <!-- servlet & jsp --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>javax.servlet.jsp-api</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> </dependencies> <build> <finalName>art</finalName> <!-- <pluginManagement> --> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-java2ws-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>process-classes</id> <phase>process-classes</phase> <configuration> <className>art.VmxService</className> <outputFile>${project.basedir}/src/main/resources/VmxService.wsdl</outputFile> <genWsdl>true</genWsdl> <verbose>true</verbose> <address>http://localhost:9080/art/VmxService</address> </configuration> <goals> <goal>java2ws</goal> </goals> </execution> </executions> </plugin> </plugins> <!-- </pluginManagement> --> </build> </project>
The pluginManagement section serves a similar purpose like the dependencyManagement section. It defines plugins and their version and configuration defaults, without actually adding them to the maven build lifecycle. Once the plugin is added in a module it will pick up the configuration from the pluginManagement section. Also see: Maven: What is pluginManagement? So if a similar configuration of the same plugin is used in multiple modules you can collect them together in one place. If the plugin is only used in one module I prefer to just put it in there directly in the build. But both ways work. Remember you also need to add the plugin to the build.plugins - simply having them in pluginManagement does nothing. The warning in eclipse relates more to the life-cycle of your IDE. It differs a bit from the maven lifecycle and in some cases it cannot detect (or could not?) at what moment a plugin is supposed to run. Some plugins also cannot execute without a maven project. So I'm never sure what that lifecycle-mapping plugin tries to solve :/ Anyways: if you generate the classes using a maven build and this works for you (not having that done when telling eclipse to 'build' the project without maven) you're good. I thought that information (the lifecycle mapping) is nowadays baked into the plugins directly and read by the m2eclipse plugin. I've seen such xml files in some plugins. So the lifecycle-mapping plugin might not be required anymore at all.
JSF2.2 in eclipse on wildfly8.1
I have a project created from some maven archetype, dont remmebrer realy which one. I use maven and Eclipse Kepler. The project is deployed on Wildfly8.1 server In the project facests I have JSF 2.0 and when I try to change the facet to JSF 2.2 I get the massege "Cann not change version of facet JavaServerFaces ..." Do I have to change something in my maven pom file? Here is my maven pom : <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>ypay</artifactId> <groupId>si.arctur</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>ypay-web</artifactId> <packaging>war</packaging> <name>ypay Web module</name> <dependencies> <dependency> <groupId>org.jboss.spec.javax.ejb</groupId> <artifactId>jboss-ejb-api_3.1_spec</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.primefaces.extensions</groupId> <artifactId>primefaces-extensions</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>4.0</version> </dependency> <!-- Dependency on the EJB module so we can use it's services if needed --> <dependency> <groupId>si.arctur</groupId> <artifactId>ypay-ejb</artifactId> <type>ejb</type> <scope>provided</scope> </dependency> <!-- Import the JAX-RS API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>org.jboss.spec.javax.ws.rs</groupId> <artifactId>jboss-jaxrs-api_1.1_spec</artifactId> <scope>provided</scope> </dependency> <!-- Import the CDI API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>provided</scope> </dependency> <!-- Import the JPA API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <scope>provided</scope> </dependency> <!-- Import the JSF API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>org.jboss.spec.javax.faces</groupId> <artifactId>jboss-jsf-api_2.2_spec</artifactId> <version>2.2.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.omnifaces</groupId> <artifactId>omnifaces</artifactId> <version>1.7</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! --> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> </project>
You don't mention which Eclipse plugins you use. Assuming you have a current version of JBoss Tools, the facets should be set correctly when first importing the Maven project into Eclipse, depending on the POM dependencies. In your POM, there's a mixture of Java EE 6 and 7 dependencies, which might be causing the problem. Try deleting the javax:javaee-api:6.0 dependency - you have indidual Java EE 7 APIs further down in your POM -, then run Maven | Update project in Eclipse. If that does not help, delete the project from the workspace, delete all Eclipse metadata from the file system (.project, .classpath,. settings) and re-import the project.
Maven, plugins, and JIRA
I've been running through the hello world example from JIRA(https://developer.atlassian.com/display/DOCS/Getting+Started). Eclipse (Kepler) gives me a large list of errors in the pom for my project. Specifically on the first plugin tag. All of them are some variation of Plugin execution not covered by lifecycle configuration: com.atlassian.maven.plugins:maven-jira- plugin:4.2.10:filter-test-plugin-descriptor (execution: default-filter-test-plugin-descriptor, phase: process-test- resources) with descriptions after the second colon. I think these are the goals. I've come across this but it wasn't much help to someone who was completely new to all this. Here is the pom that was generated by Atlassian: <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.atlassian.tutorial</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <organization> <name>HelloGoodby Inc.</name> <url>http://www.helloworldgoodbye.com</url> </organization> <name>helloworld</name> <description>This is the com.atlassian.tutorial:helloworld plugin for Atlassian JIRA.</description> <packaging>atlassian-plugin</packaging> <dependencies> <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-api</artifactId> <version>${jira.version}</version> <scope>provided</scope> </dependency> <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. --> <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x --> <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-core</artifactId> <version>${jira.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> <!-- WIRED TEST RUNNER DEPENDENCIES --> <dependency> <groupId>com.atlassian.plugins</groupId> <artifactId>atlassian-plugins-osgi-testrunner</artifactId> <version>${plugin.testrunner.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> <version>1.1.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.2-atlassian-1</version> </dependency> <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit --> <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit --> <!-- <dependency> <groupId>com.atlassian.jira.tests</groupId> <artifactId>jira-testkit-client</artifactId> <version>${testkit.version}</version> <scope>test</scope> </dependency> --> <dependency> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-amps-plugin</artifactId> <version>4.2.10</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-jira-plugin</artifactId> <version>${amps.version}</version> <extensions>true</extensions> <configuration> <productVersion>${jira.version}</productVersion> <productDataVersion>${jira.version}</productDataVersion> <!-- Uncomment to install TestKit backdoor in JIRA. --> <!-- <pluginArtifacts> <pluginArtifact> <groupId>com.atlassian.jira.tests</groupId> <artifactId>jira-testkit-plugin</artifactId> <version>${testkit.version}</version> </pluginArtifact> </pluginArtifacts> --> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <properties> <jira.version>6.1.3</jira.version> <amps.version>4.2.10</amps.version> <plugin.testrunner.version>1.1.2</plugin.testrunner.version> <!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x --> <testkit.version>5.2.26</testkit.version> </properties> </project>
And yet, "this" is exactly going to fix your problem for you. While Maven just bluntly executes whatever plugins are configured, the Maven Integration (m2e) in Eclipse is a bit more reluctant in doing so. Not everything that makes sense for execution on the command-line should also be executed while within Eclipse. Now, some common plugins it will automatically take care of, but when it encounters the Atlassian plugins it seemingly does not know what to do, and wants your help with that. Depending on the plugin in question, you can either: Install a m2e connector for that particular plugin (which will know what to do) Configure what to do within your POM file (pom.xml) Configure what to do within your local Eclipse These are given in (my) order of preference. In any case 2. makes a lot of sense, because each developer who imports your POM file will be good to go, think about that. The configuration in the POM file can either tell m2e to ignore or execute the plugin execution, and in the latter case whether to run on incremental builds (runOnIncremental). "The link" gives examples of this configuration, which is configured as lifecycleMappingMetadata in a plugin configuration under pluginManagement of your POM. The good news is that Eclipse can help you with the three solutions above using a quick fix on the error that you're seeing.
mvn install not installing/embedding dependencies
I have been told that the install goal should mean that my resulting jar file will have all required dependencies included into the deployment. This, however, doesn't appear to be working for me. Here's my 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>org.zone.commandit</groupId> <artifactId>CommandIt</artifactId> <version>0.2</version> <name>CommandIt</name> <repositories> <repository> <id>bukkit-repo</id> <url>http://repo.bukkit.org/content/groups/public</url> </repository> <repository> <id>milkbowl-repo</id> <url>http://ci.herocraftonline.com/plugin/repository/everything/</url> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> <version>1.5.2-R1.0</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>net.milkbowl.vault</groupId> <artifactId>Vault</artifactId> <version>1.2.26-SNAPSHOT</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>se.krka.kahlua</groupId> <artifactId>kahlua-cldc11</artifactId> <version>5.1_2.1.0</version> </dependency> <dependency> <groupId>se.krka.kahlua</groupId> <artifactId>kahlua-core</artifactId> <version>5.1_2.1.0</version> </dependency> <dependency> <groupId>se.krka.kahlua</groupId> <artifactId>kahlua-interpreter</artifactId> <version>5.1_2.1.0</version> </dependency> <dependency> <groupId>se.krka.kahlua</groupId> <artifactId>kahlua-j2se</artifactId> <version>5.1_2.1.0</version> </dependency> </dependencies> </project> From this, I expect a CommandIt-0.2.jar file with commons-io and the kahlua libraries (which are installed in the local repository). The bukkit and Vault dependencies should not be included as they are provided in the runtime environment. However, upon inspecting the project jar file with 7zip, I find only META-INF and my own source code. What am I doing wrong?
You can use the Maven Assembly plugin to generate a JAR containing all your dependencies. Add the following in the build > plugins section: <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> The Maven target to run this plugin is assembly:single.
Maven dependencies are downloaded to the local maven repository, it is usually .m2 directory in your user home directory. Packaging JAR doesn't include any other JARs into the result. If you want to make a web application, use packaging WAR (or EAR). In the WAR file there are your JARs inc. all dependencies included.
mvn install executes plugins which simply put whatever artifacts were built, in this case a JAR file with your code, into your local repository, typically located at ~/.m2/repository. If you want to assemble something to distribute, like a tarball containing JARs and shell scripts, looking into the Maven assembly plugin. If you want to assemble a single JAR file containing your code and the code in your dependencies, the Maven assembly plugin can be run using the jar-with-dependencies descriptor.