maven-2

Maven: Packaging dependencies alongside project JAR?

自古美人都是妖i 提交于 2019-12-17 21:53:02
问题 I'd like Maven to package a project alongside its run-time dependencies. I expect it to create a JAR file with the following manifest: ..... Main-Class : com.acme.MainClass Class-Path : lib/dependency1.jar lib/dependency2.jar ..... and create the following directory structure: target |-- .... |-- my-project.jar |-- lib |-- dependency1.jar |-- dependency2.jar Meaning, I want the main JAR to exclude any dependencies and I want all transitive dependencies to get copied into a "lib" sub-directory

How to run Tomcat 7 using Maven 2 Tomcat plugin?

北慕城南 提交于 2019-12-17 21:49:37
问题 I am using Maven 2 and I have an external Tomcat 7 . I was wondering how to run Tomcat 7 from using Maven Tomcat plugin. And does Maven Tomcat plugin in Maven 3 runs the Tomcat 7 by default. Thanks. 回答1: This works for me: http://tomcat.apache.org/maven-plugin-2.1/ With this plugin config: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <path>/</path> </configuration> </plugin> And running with mvn clean

Multi-module Maven project and jetty:run

喜夏-厌秋 提交于 2019-12-17 21:46:40
问题 I'm trying to split a Maven WAR project into two modules, so that I can build a separate JAR file with command line tools. The result has the following structure: pom.xml (packaging pom , has two modules) project-jar/ pom.xml (packaging jar ) project-war/ pom.xml (packaging war , depends on project-jar ) If I run mvn commands from the root, everything works fine. I'd like to keep using mvn jetty:run , but for that I need to execute the command in the WAR subproject. If I do that, fails to

NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()

心已入冬 提交于 2019-12-17 20:49:42
问题 Hello all I'm getting this very strange error: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lor g/hibernate/classic/Session; at org.cometd.hibernate.util.HibernateUtil.getSessionFactory(HibernateUt il.java:29) at org.cometd.hibernate.util.HibernateUtil.getSession(HibernateUtil.java :54) But this method exists in SessionFactory class in JavaDocs! My Eclipse also shows me it in the autocomplete. But some other methods, i.e. openSession() or closeSession() work

JPA composite primary key [duplicate]

大憨熊 提交于 2019-12-17 20:35:38
问题 This question already has answers here : Mapping ManyToMany with composite Primary key and Annotation: (2 answers) Closed 4 years ago . I have the following classes in my JPA model (getters, setters, and irrelevant fields omitted): @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class Currency { @Id private Integer ix; } @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY)

Maven assembly - Error reading assemblies

假如想象 提交于 2019-12-17 19:18:17
问题 I have defined a personalized jar-with-dependencies assembly descriptor. However, when I execute it with mvn assembly:assembly, I get : ... [INFO] META-INF/ already added, skipping [INFO] META-INF/MANIFEST.MF already added, skipping [INFO] javax/ already added, skipping [INFO] META-INF/ already added, skipping [INFO] META-INF/MANIFEST.MF already added, skipping [INFO] META-INF/maven/ already added, skipping [INFO] [assembly:assembly {execution: default-cli}] [INFO] ---------------------------

Maven's jetty plugin SSL configuration issue

痞子三分冷 提交于 2019-12-17 18:59:25
问题 I'm using Jetty's plugin for Maven, version 7.0.0.pre5, but I have issues configuring it to have a SSL Connector. Whenever I start the application, it fails stating that the requested implementation is not found. This is the plugin's configuration within my pom.xml <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>7.0.0.pre5</version> <configuration> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port

Maven Error: Could not find or load main class

谁说我不能喝 提交于 2019-12-17 18:34:07
问题 I'm using a Java Maven program and I don't know what to enter as the <mainClass> . I've tried all kinds of things based off of numerous stackoverflow questions, but they are not solving the error. Each time it says: Maven Error: Could not find or load main class ... I have this written inside my pom.xml (minus the ??? ) <build> ... <plugins> ... <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.5.3</version> <configuration> <descriptors> <descriptor>src/main/assembly/jar-with

Renaming Maven dependency in WAR's WEB-INF/lib folder

狂风中的少年 提交于 2019-12-17 18:28:40
问题 I need to have a JAR dependency in the Maven generated WAR's WEB-INF/lib folder as x-1.0.final.jar instead of x-1.0.jar , which is the name it has in the repository. What would be the best way to achieve this? In my POM I have: <dependency> <groupId>foo</groupId> <artifactId>x</artifactId> <version>1.0</version> </dependency> I want this to appear in the WEB-INF/lib folder as x-1.0.final.jar . It's and external dependency on Maven Central I don't have control over. Also I don't want to force

Looking for Webstart Maven Plugin sample application [closed]

邮差的信 提交于 2019-12-17 18:23:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am looking for source code for a complete application that uses the Webstart Maven Plugin. Any ideas? 回答1: I tried the webstart plugin in a prrof of concept involving an embedded tomcat server. The plugin is bound to the package phase and takes a longtime to execute, I would recommend to invoke it manually