java - Error: Could not find or load main class - how to compile to jar by maven? -


I have a problem compiling classes in jars when I try to run the mvn package ant then I get an error , Or the main square can not be loaded.

  & lt; Project xmlns = "http://maven.apache.org/POM/ 4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schema location = "http: / /maven.apache.org/POM/4.0.0 http: // maven .apache.org / XSD / Maven-4.0.0.xsd "& gt; & Lt; ModelVersion & gt; 4.0.0 & lt; / ModelVersion & gt; & Lt; Group & gt; Com.test & lt; / Group & gt; & Lt; ArtifactId & gt; JIRA-ray-index & lt; / ArtifactId> & Lt; Version & gt; 1.0.0-snapshots & lt; / Edition & gt; & Lt; Packaging & gt; Jar & lt; / Packaging & gt; & Lt; Name & gt; JIRA-ray-index & lt; / Name & gt; & Lt; URL & gt; Http: //maven.apache.org< / URL & gt; & Lt; Properties & gt; & Lt; Project.build.sourceEncoding & gt; UTF-8 & LT; /project.build.sourceEncoding> & Lt; / Properties & gt; & Lt; Dependency & gt; & Lt; Dependency & gt; & Lt; Group & gt; JUnit & lt; / Group & gt; & Lt; ArtifactId & gt; JUnit & lt; / ArtifactId> & Lt; Version & gt; 3.8.1 & lt; / Edition & gt; & Lt; Scope & gt; Trial & lt; / Scope & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Net.sourceforge.htmlunit & lt; / Group & gt; & Lt; ArtifactId & gt; Htmlunit & lt; / ArtifactId> & Lt; Version & gt; 2.15 & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; Dependency & gt; & Lt; Group & gt; Log4j & lt; / Group & gt; & Lt; ArtifactId & gt; Log4j & lt; / ArtifactId> & Lt; Version & gt; 1.2.17 & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt; / Dependencies & gt; & Lt; Construction & gt; & Lt; PluginManagement & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-compliant plugin & lt; / ArtifactId> & Lt; Version & gt; 3.1 & lt; / Edition & gt; & Lt; Configuration & gt; & Lt; Source & gt; 1.7 & lt; / Source & gt; & Lt; Goal & gt; 1.7 & lt; / Target & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt; & Lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-assembly-plug-in & lt; / ArtifactId> & Lt; Version & gt; 2.4 & lt; / Edition & gt; & Lt; Configuration & gt; & Lt; Collections & gt; & Lt; Appearance & gt; & Lt; MainClass & gt; Com.test.main.App & lt; / MainClass & gt; & Lt; / Reveal & gt; & Lt; / Collection & gt; & Lt; DescriptorRefs & gt; & Lt; DescriptorRef & gt; Jarar-with-Dependency & lt; / DescriptorRef & gt; & Lt; / DescriptorRefs & gt; & Lt; / Configuration & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; ID & gt; Makeup assembly & lt; / Id & gt; & Lt; Step & gt; Package & lt; / Step & gt; & Lt; Goals & gt; & Lt; Goal & gt; A & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; / Plugin & gt; & Lt; / Plugins & gt; & Lt; / PluginManagement & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-assembly-plug-in & lt; / ArtifactId> & Lt; / Plugin & gt; & Lt; / Plugins & gt; & Lt; / Create & gt; & Lt; / Project & gt;  

What am I doing wrong? My main class is in src / main / java / com.test.main.App

> To help with the Maven-Jar-plugin

  & lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven-Jar-plugin & lt; / ArtifactId> & Lt; Configuration & gt; & Lt; Collections & gt; & Lt; Appearance & gt; & Lt; MainClass & gt; Com.test.main.App & lt; / MainClass & gt; & Lt; / Reveal & gt; & Lt; / Collection & gt; & Lt; / Configuration & gt; & Lt; / Plugin & gt;  

While used for maven-assembly-plugin

Maven users primarily for assembly plugins Allow to collect the project output, its dependencies, modules, site documentation and other files in a single distribution archive.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -