Package not found in maven jetty plugin - java

When i try to run jetty maven plugin(mvn jetty:run) I have received this error:
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
D:\projects\Projekt\src\main\java\Runner.java:[18,22] package org.apache.uima does not exist
This package use class Runner, and it seems that it was not found, how can i add it?
I have tried to use <webAppConfig>, but it doesn't help...

Update2: Uima is now available in a publicly available Maven repo, no need to configure your repository list.
Update: Uima is available on the Apache's m2 http://people.apache.org/repo/m2-incubating-repository. You'll need to configure your settings to reference the repository and add the dependency(ies) to your pom.
The dependency for uima-core looks like this:
<dependency>
<groupId>org.apache.uima</groupId>
<!--note there are several other uima jars you may want to reference-->
<artifactId>uimaj-core</artifactId>
<version>2.4.0</version>
</dependency>

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.5.v20170502</version>
<configuration>
<httpConnector>
<port>9999</port>
</httpConnector>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>

Related

Maven Proguard plugin - "proguard.Proguard not found on classpath" error

I am trying to obfuscate a jar-with-dependencies (although the same problem affects if I set as inFile the regular single jar).
I am using Java 8, but I have to use newer versions of Proguard and Proguard Maven Plugin, due to coverage of some jar dependencies that are from a higher version (otherwise I get an "Unsupported major-minor version" problem).
When executing "mvn clean install" the step is executed but I get a "proguard jar not found in pluginArtifacts error". See log below.
I have seen in Proguard Maven Plugin code that now you need (from 7.0.0) both proguard-base and proguard-core from com.guardsquare instead of the outdated previous version in net.sf.proguard - this one is not prepared for later jars.
Apparently the proguard jar is not found where I am specifying it - how should I include this dependency?
I am using this in my pom:
<build>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>proguard</goal></goals>
<configuration>
<injar>${project.build.finalName}-jar-with-dependencies.jar</injar>
<outjar>${project.build.finalName}-small.jar</outjar>
<proguardVersion>7.1.0</proguardVersion>
<options>
<option>-allowaccessmodification</option>
<option>-dontoptimize</option>
<option>-dontshrink</option>
<option>-dontnote</option>
<option>-dontwarn</option> <!-- added option to ignore com.sun missing classes -->
<option>-keepattributes Signature</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<dependencies>
<dependency>
<groupId>com.guardsquare</groupId>
<artifactId>proguard-base</artifactId>
<version>7.1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.guardsquare</groupId>
<artifactId>proguard-core</artifactId>
<version>7.1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.4.0</version>
</plugin>
<plugins>
<pluginManagement>
</build>
Running it with -X debug flag:
[... proguard execution command which ends in:]
-printseeds, 'C:\workspace\xxx\target\proguard_seed.txt', -verbose, -allowaccessmodification, -dontoptimize, -dontshrink, -dontnote, -dontwarn, -keepattributes Signature]
...
[DEBUG] pluginArtifact: C:\User\myuser\.m2\repository\org\eclipse\sisu\org.eclipse.sisu.inject\0.0.0.M5\org.eclipse.sisu.inject-0.0.0.M5.jar
[DEBUG] pluginArtifact: C:\User\myuser\.m2\repository\org\codehaus\plexus\plexus-component-annotations\1.5.5\plexus-component-annotations-1.5.5.jar
[DEBUG] pluginArtifact: C:\User\myuser\.m2\repository\org\codehaus\plexus\plexus-classworlds\2.4\plexus-classworlds-2.4.jar
[INFO] proguard jar not found in pluginArtifacts
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.302 s
[INFO] Finished at: 2021-08-17T18:26:45
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.3.1:proguard (default) on project xxx: Obfuscation failed ProGuard (proguard.ProGuard) not found in classpath -> [Help 1]
The jar-with-dependencies is generated with Maven Assembly plugin.
I am using Java 1.8.
I was actually using proguard.Proguard instead of proguard.ProGuard. Typo took a day out of me.
However, there is some extra trickyness associated, in case it helps anyone: proguard-maven-plugin would not let me define newer versions of proguard dependencies except for the default one. E.g. 2.4.0 would only allow me to use 7.1.0-beta3 which is the default. It didn't recognize the libraries I would set in the dependencies section inside the plugin (for example, for 7.1.1).

Maven - Exclude Plugin from another Plugin

I've got a plugin that I need to use in my build. This plugin, however, has a build-time dependency on another plugin and that dependency does not work post-Java-8.
Specifically, the plugin that I want to use has this in its pom.xml file
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>${javaVersion}</version>
<scope>system</scope>
<systemPath>${tools.jar}</systemPath>
</dependency>
</dependencies>
<executions>
<execution>
<phase>test-compile</phase>
......
</execution>
</executions>
</plugin>
It's set to the test-compile phase, so it's only ever run when the plugin itself is being built, and not when it's being used.
The problem is that it's got the systemPath as part of the dependency, and this is set to something that is not resolvable using Java 9+. That in turn causes the build for the project using the plugin to fail with:
[ERROR] 'dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} #
So either I need to completely ignore the maven-antrun-plugin as part of my using this plugin, or I need to at least make the dependencies for it work.
Any thoughts?
Cheers

failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7

I'm getting this error all of a sudden in maven and i'm not sure why:
Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project
I searched in intellij for 2.7 as well as maven-resources-plugin and we aren't using those. Why is maven suddenly complaining about this when I don't even use that plugin?
There seems to be a problem with the maven-filtering dependency.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
I had .der files in my src/main/resources which now when removed it builds successfully.

Maven site command fails

I'm trying to get maven site working, but I'm blocked on this error.
[INFO] Failed to resolve artifact.
Failed to resolve artifact, possibly
due to a repository list that is not
appropriately equipped for this
artifact's metadata.
org.apache.maven.plugins:maven-pmd-plugin:pom:2.6-SNAPSHOT
from the specified remote
repositories: sonar
(http://sonar:9000/deploy/maven),
central
(http://repo1.maven.org/maven2),
risk-idi
(http://nexus.yyy.com/nexus/content/groups/public-all)
I'm using maven 2.2.1 and maven site plugin version 2.2.
Any help will be appreciated.
I've found no maven-pmd-plugin-2.6-SNAPSHOT in the official maven repository (proof). You can try to specify its version explicitly:
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</reporting>
...
</project>
Configuration is taken from here.

Maven FindBugs plugin

You have usage: findbugs-maven-plugin
<project>
[...]
<reporting>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<xmlOutput>true|false</xmlOutput>
<xmlOutputDirectory>directory location of findbugs xdoc xml report</xmlOutputDirectory>
<threshold>High|Normal|Low|Exp|Ignore</threshold>
<effort>Min|Default|Max</effort>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
<includeFilterFile>findbugs-include.xml</includeFilterFile>
<visitors>FindDeadLocalStores,UnreadFields</visitors>
<omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
<onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
<pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
<debug>true|false</debug>
<relaxed>true|false</relaxed>
<findbugsXmlOutput>true|false</findbugsXmlOutput>
<findbugsXmlOutputDirectory>directory location of findbugs legact xml format report</findbugsXmlOutputDirectory>
</configuration>
</plugin>
[...]
</reporting>
[...]
</project>
But once:
mvn site
I get:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.codehaus.mojo
ArtifactId: findbugs-maven-plugin
Version: 1.2.1
Reason: Unable to download the artifact from any repository
org.codehaus.mojo:findbugs-maven-plugin:pom:1.2.1
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Do you know why? What should I do?
Looking at the repository, your version should be 1.2, not 1.2.1
Also, your configuration is wrong, you need to choose some of the options. So it should look like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<threshold>High</threshold>
<effort>Default</effort>
</configuration>
</plugin>
try that:
<version>1.2</version>
http://repo2.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/
Seems like they did a simple copy/paste error.
The report will be in target/site. Look at the file index.html in a browser, than look for project reports, then findbugs report.
As part of your parent project structure place site.xml into parent-project/src/site:
|--- src
|---site
|---site.xml
An example site.xml from "Better Builds with Maven" (a free book available online) should get you started.
Once site.xml is created, execute mvn site from the parent project directory. It will pick up your reporting settings including the firebug report. Once the site is built, each child project will have directory /target/site, which contains index.html with a link to project reports. The project reports should contain firebug reports.

Categories

Resources