Maven dependency not found but present in mvnrepository - maven

I created a simple web scraper with Java and Selenium. It just reads a single piece of information and writes that to a CSV file.
I'm trying to run it daily using some scheduler on Heroku. The official Heroku documentation says I need to add this to the pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
But when I add it to the pom.xml, I'll get
Plugin 'org.apache.maven.plugins:maven-dependency-plugin:3.0.1' not found
even though it found in mvnrepository.com. What is happening here?

First of all, run the build again (with something like mvn clean verify) and see if you get the error again.
If so, you probably have a network/firewall issue, or you misconfigured your settings.xml (if you have one).

Related

Deployment deploys twice or not at all

I managed to build a Maven project in a way that makes the release deploy artifacts either double or not at all.
Since the project uses an abstract parent pom of our company it's a bit hard to post the relevant code, but I'll try.
First things first. The parent pom has the following definition:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<deployAtEnd>true</deployAtEnd>
</configuration>
</plugin>
With nothing defined in the actual project, the release will fail after these lines:
[INFO] [INFO] Uploaded to our_repo: http://acme.org/nexus/content/repositories/org.acme.project/1.0.0/org.acme.project-1.0.0-sources.jar (14 kB at 3.8 kB/s)
[INFO] [INFO] Uploading to our_repo: http://acme.org/nexus/content/repositories/org.acme.project/1.0.0/org.acme.project-1.0.0-sources.jar
Our repo doesn't like having two release JARs with the same version, so everything fails. The weird part here is that the deployment is NOT at the end. In fact the project build fails halfway through.
However if I copy the above plug-in in the project, the build will print Deploying repo:org.acme.repo:1.0.0 at end at the same position and then not deploy anothing at the end.
But I'm not even sure that's part of the problem. Still I think both builds should work exactly the same no matter where the plug-in definition is.
I found this question, which made me check the maven-source-plugin in the effective pom. However there are no duplicates there:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
<configuration>...</configuration>
</execution>
</executions>
</plugin>
Nothing is defined in the maven-assembly-plugin either, so no JAR is added for deployment (suggested in this question).
It might have to do with us using Java 10 or Maven 3.5.2, though I'm honestly stumped on what to test and where to progress.
How do I fix this mess? (If you'd like more information about the build, just ask. The pom.xml is way to big to share them here.)
Inspired by that question I tried to disable the release profile, and now it works somehow. I'm not able to conjure any kind of explanation for that behavior.
Snippet for removing the release profile:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>

Are directions available for the maven plugin com.alexnederlof jasperreports-plugin?

I have read up on the limited information regarding com.alexnederlof jasperreports-plugin and I'm looking to convert my current ant build to use this maven plugin, but there doesn't seem to be any documentation available.
My biggest concern is run-time: If I use this plugin at build-time, what version of jasper-reports do I need to use at run-time?
Am I missing a reference somewhere? As the old adage goes, "If there isn't any documentation, then I guess I'll have to write it."
I am not sure of what you are after but, I am using this plugin in maven to generate the source .jrxml files to .jasper files and the configuration in pom goes like this:
<plugin>
<groupId>com.alexnederlof</groupId>
<artifactId>jasperreports-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>jasper</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- These are the default configurations: -->
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
<sourceDirectory>src/main/jasperreports</sourceDirectory>
<outputDirectory>${basedir}/src/main/webapp</outputDirectory>
<outputFileExt>.jasper</outputFileExt>
<xmlValidation>true</xmlValidation>
<verbose>false</verbose>
<numberOfThreads>4</numberOfThreads>
<failOnMissingSourceDirectory>true</failOnMissingSourceDirectory>
<sourceScanner>
org.codehaus.plexus.compiler.util.scan.StaleSourceScanner
</sourceScanner>
</configuration>
</plugin>
Hope this helps

Executing specific execution id in maven

I am trying to use maven-release-plugin to publish npm packages. For this I am using frontend-maven-plugin. The release itself is working well using, except when the maven-release-plugin is transforming the pom.xml version to the next development iteration X.X.X-SNAPSHOT.
For this I want to be able to execute a specific execution id by specifying goal in mvn.
More specifically I am trying to run a goal from frontend-maven-plugin with a specific configuration from the <completionGoals> tag in maven-release-plugin, in order to keep the pom.xml file and package.json versions in sync after the release process.
In the example below I am trying to use the # symbol to explicitly specify which execution I want to execute in the goal (the "setversion" execution) , but that does not seem to work, I get “Could not find goal 'npm#setversion'” error during the release. I have tried to use parameters directly in the goal specification but without any success.
Any ideas?
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<releaseProfiles>gui-komponent-release</releaseProfiles>
<completionGoals>com.github.eirslett:frontend-maven plugin:npm#setversion</completionGoals>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>setversion</id>
<goals>
<goal>npm</goal>
</goals>
<phase />
<configuration>
<arguments>version ${project.version}</arguments>
</configuration>
</execution>
...

maven-plugin-plugin helpmojo breaking change?

I have a Maven plugin which is a year or two old. Recently I noticed that the helpmojo goal of maven-plugin-plugin appears to not be working.
It is working for an older version of the plugin - I'm not sure at which release it stopped working.
By "not working" I mean that the help goal is not correctly generated and is not found when called using mvn <plugin>:help, whilst other goals are found.
HelpMojo.java is created under target/generated-sources/plugin, but no entry appears in the the plugin descriptor, plugin.xml in the final .jar.
Has a bug or breaking change been introduced in a recent version of maven-plugin-plugin or have I changed something which has prevented it from working as a side-effect? (For example, the plugin project is now multi-module.)
The pom.xml config looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>generated-helpmojo</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
The fix was to downgrade to version 3.1

Jboss Maven JdocBook Plugin, Multiple Executions

My team is working on a webservice project, and I am working on creating the documentation for the web service API. I have used a custom JavaDoc doclet to create two xml outputs of the available methods, one for internal developers and one for external developers.
Now, we are using the Jboss Maven Jdocbook plugin to create a DocBook output, along with other xml files, to create a users guide for our webservices.
What I want to do is run the Maven JdocBook plugin twice, once using the internal methods and once on the external methods, to create two separate users guides for either internal or external developers, using two different master.xml files. The pom file:
<build>
<defaultGoal>generate</defaultGoal>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<extensions>true</extensions>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<formats>
<format>
<formatName>html</formatName>
</format>
<format>
<formatName>html_single</formatName>
</format>
</formats>
</configuration>
<executions>
<execution>
<id>internal</id>
<phase>compile</phase>
<configuration>
<baseOutputDirectory>../../Test/JavaDocTest/internal/</baseOutputDirectory>
<sourceDocumentName>masterInternal.xml</sourceDocumentName>
</configuration>
</execution>
<execution>
<id>external</id>
<phase>compile</phase>
<configuration>
<baseOutputDirectory>../../Test/JavaDocTest/external/</baseOutputDirectory>
<sourceDocumentName>masterExternal.xml</sourceDocumentName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-style-plugin</artifactId>
<version>1.0.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
The problem I am running in to is that unless I put the sourceDocumentName in the base configuration (outside of the execution section and in the section with the formats) the build does not recognize the different source document name. The standard master file is called master.xml, and on compiling in NetBeans, it says it is looking for master.xml, which it can't find because it does not exist, and then skips the generation.
It is appearing to just skip the execution sections altogether, as when I try to run the build with multiple executions (such as above) it still just runs once. Any ideas why it's skipping the execution sections?
I believe it might have something to do with the phase tag of the execution, but according to http://www.jboss.org/maven-jdocbook-plugin/ there are only a few phases (process-resources, compile, package, install, deploy), and I've tried all of them and none of them seem to work.
Thanks in advance.
My group figured out that you need to set sourceDocumentName in the main configuration area. It turns out that the docbook is generated once using the main config section, and then it looks for any other executions and runs those using the specific sub-configuration for that execution.
Hope this helps someone in the future.

Resources