Note that there are some explanatory texts on larger screens.

plurals
  1. POadd custom jar to maven local repository
    text
    copied!<p>I want to add a custom jar to my Project. As I understand it the best way to do that is to first add the jar to my local repository and then to add it to my pom.xml.</p> <p>So I tried the following:</p> <pre><code> mvn install:install-file -Dfile=/home/martin/linuxhome/work/libMediator/libMediator /dist/libMediator.jar -DgroupId=com.src.libMediator -DartifactId=libMediator Dversion=1.0 -Dpackaging=jar -DgeneratePom=true </code></pre> <p>and then I added the following to my pom.xml:</p> <pre><code>... &lt;packaging&gt;war&lt;/packaging&gt; ... &lt;dependencies&gt; ... &lt;dependency&gt; &lt;groupId&gt;com.src.libMediator&lt;/groupId&gt; &lt;artifactId&gt;libMediator&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; </code></pre> <p>Unfortunately I get the following error:</p> <pre><code>[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Reportgenerator 1.0.0-BUILD-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for joda-time:joda-time-jsptags:jar:1.0.2 is missing, no dependency information available [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ Reportgenerator --- [debug] execute contextualize [INFO] Copying 26 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Reportgenerator --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 21 source files to /home/martin/linuxhome/Dropbox/c/Reportgenerator/target/classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/martin/linuxhome/Dropbox/c/Reportgenerator/src/main/resources/boilerplate/ReportIdentifizierer.java:[8,32] package com.src.libMediator.prod does not exist [ERROR] /home/martin/linuxhome/Dropbox/c/Reportgenerator/src/main/resources/boilerplate/ReportIdentifizierer.java:[30,19] cannot find symbol symbol: variable C_ProdUtility location: class boilerplate.ReportIdentifizierer [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.116s [INFO] Finished at: Sat Sep 07 15:30:50 CEST 2013 [INFO] Final Memory: 18M/169M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Reportgenerator: Compilation failure: Compilation failure: [ERROR] /home/martin/linuxhome/Dropbox/c/Reportgenerator/src/main/resources/boilerplate/ReportIdentifizierer.java:[8,32] package com.src.libMediator.prod does not exist [ERROR] /home/martin/linuxhome/Dropbox/c/Reportgenerator/src/main/resources/boilerplate/ReportIdentifizierer.java:[30,19] cannot find symbol [ERROR] symbol: variable C_ProdUtility [ERROR] location: class boilerplate.ReportIdentifizierer [ERROR] -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException </code></pre> <p>C_ProdUtility is a class from the jar I want to include, boilerplate.ReportIdentifizierer is a class which belongs to the Project I am working on.</p> <p>I have tried to google the problem, but none of the solutions I found worked. I could use the System Scope and give the location of the jar via </p> <pre><code>&lt;systemPath&gt;${project.basedir}/lib/libMediator.jar&lt;/systemPath&gt; </code></pre> <p>. Then it compiles but this is discouraged and the jar isn't provided at runtime. I haven't found out how to do that.</p> <p>If I use </p> <p>compile</p> <p>The resulting .war gives the following error-message:</p> <pre><code>java.lang.ClassNotFoundException: com.src.libMediator.prod.C_ProdUtility from [Module "deployment.Reportgenerator.war:main" from Service Module Loader] </code></pre> <p>I verified that com.src.libMediator.prod.C_ProdUtility is in the libMediator.jar</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload