Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories ,Plugin not found in any plugin repository - maven-plugin

I am trying to Maven build my Java project but it is getting failed and i am getting below error:
Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories [local (C:\Users\Vinita.Gupta.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]
I am trying to build the project in Eclipse Neon and have installed and setup Maven path,m2connector for Eclipse.
Note: I am not connected to network using any proxy
Most of the solutions which i have found online were having issues due to proxy settings but i am directly connected to network and able to browse below directory via browser but couldn't connect through Maven:
https://repo.maven.apache.org/maven2
Please help !!

I had the same error, but for the maven-failsafe-plugin.
With the help of a colleague, we got rid of the problem adding the version line to the plugin declaration in the project pom.xml. We added the <version>2.20.1</version> line resulting in the following plugin declaration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skipTests>false</skipTests>
<argLine>-Djava.library.path=${project.parent.basedir}/lib/${arquitecturaMaquina}</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
It is a long working project (over a year) and never had this error. I do not know what triggered it, but all the other answers about resetting the local repository, checking the proxy, etc did not work.
Then we added that version line to the pom.xml and the project built correctly again. Now I removed the line and it is still working. My guess is that it indeed had something to do with some messed up cache of some kind, and that requiring the specific version got rid of the mess and now it is working as before the problem appeared.

Add this to your pom.xml and it should work
<pluginRepositories>
<pluginRepository>
<id>maven2</id>
<url>https://repo.maven.apache.org/maven2/</url>
</pluginRepository>
</pluginRepositories>

I had a weird solution. I got the same error when i was connected in Office LAN. Once I switched to common wifi, the error was not thrown. So i believe this is more to do with the network restriction.

Spent a day working on it, finally, the solution was to change the URL in settings.xml of a .m2 directory
old line was:
<url>http://blah:8081/bla/blabla/</url>
However, for a reason unknown to me, and from my machine only, the URL was getting rejected. As a result, I was getting the error mentioned in a title... Therefore, the solution was to put the full URL such as:
<url>http://blah.org.blah:8081/bla/blabla/</url>
-Then, simply re-open IDE (if using it), update the project (build, clean or whatever else is necessary to refresh).
You may also need to specify <port> or to add the proxy settings, but none of that was required in my case. Therefore, the solution is about adjusting the settings.xml. I have tried adding the version numbers as suggested and it was a partial solution. Cleaning and updating the project (without the settings.xml change) did nothing. Removing *.lastUpdated from .m2 was not a solution either.

What worked for me was to add a Proxy Bypass for repo.maven.apache.org under ‘Window’ > ‘Preferences’ > ‘General’ > ‘Network connections’.
After that I ran into compilation errors related to certain classes not being resolved. Just did a clean and build, viola Build Successful!

Check settings.xml file is available in C:\Users\username.m2\settings.xml and change below
C:/Users/username/.m2/repository
Its worked for me.

Added this to pom.xml and update project.
Worked for me.
<build>
<finalName>spring-security-demo</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>

Related

How to enable usage of Flight Recorder in Surefire plugin

I have added below properties in pom.xml for surefire plugin but its still filing with below error
<argLine>-XX:MaxPermSize=512m</argLine>
<argLine>-XX:+UnlockCommercialFeatures</argLine>
<argLine>-XX:+FlightRecorder</argLine>
Error: To use Flight Record first Unlock UnlockCommercialFeatures.
Any suggesting with sample pom.xml configurtion
My observation is when I run Maven build this feature is enabled for main thread but not enabled for the fork thread created by surefire pluin
You cannot use argLine repeatedly. You need to use something along the lines of
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>#{argLine} -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=1000s,filename=surefire.jfr</argLine>
</configuration>
</plugin>
instead. A similar setup works for failsafe.

upgraded flink from 1.10 to 1.11, met error 'No ExecutorFactory found to execute the application'

java.lang.IllegalStateException: No ExecutorFactory found to execute the application.
at org.apache.flink.core.execution.DefaultExecutorServiceLoader.getExecutorFactory(DefaultExecutorServiceLoader.java:84)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1803)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1713)
at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1699)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1681)
at com.cep.StaticAlarmGenerationEntryTest.main(StaticAlarmGenerationEntryTest.java:149)
The error I met after I upgraded FLink from 1.10 to 1.11, and my IDE is eclipse.
and I tried to add artifactId:flink-clients_${scala.binary.version}, but still failed. Anybody already met and solved this issue, pls tell me. thanks a lot.
See the 1.11 release note, where you now have to add an explicit dependency on flink-clients.
I have solved my problem this way :
1.Use Java 8, apparently Flink has some sort of problem with Java 11 or 15
2.Change all the Scopes to "compile"
you can change scopes in this path : Project Structure → Modules → Dependencies → There is a table that one of its column's name is Scope
I found the reason why the error happened event I add dependency flink-clients. I upgraded Flink from 1.10 to 1.11, just edited the version of Flink, but not changed Scala version. Here also should change Scala version to 2.12. And the project is generated base on 1.10 archetype and Scala version is 2.11. Every time I build the project, it use the 2.11 environments.
So the fast way to solve this issue is :
use mvn archetype:generate -DarchetypeGroupId=org.apache.flink -DarchetypeArtifactId=flink-quickstart-java -DarchetypeVersion=1.11.0 this command to generate new project.
copy all your old code to this new project. You will find that the flink-clinets already added in the pom.xml.
I had this problem when I was packaging up the flink job in a shaded jar. When shading, if there are files with the same name in multiple jars it will overwrite the file as it unzips each jar into the new shaded jar.
Flink uses the file META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory to discover different executor factories and this file is present in multiple jars, each with different contents.
To fix this, I had to tell the maven-shade plugin to combine these files together as it came across them, and this solved the problem for me.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>job</shadedClassifierName>
<transformers>
<!-- add this to combine the PipelineExecutorFactory files into one -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory</resource>
</transformer>
</transformers>
...

XL-deploy specification - what does this security spec do?

Using Maven, XL-deploy and Deployit, I want to focus extra on security on the intranet.
In examples I see the following maven, xl-deploy scripts. I have marked it with **** start ... till ... **** end.
What does it accomplish? Security for intranet and/or internet? I have been scanning the documentation for a while.
<build>
<plugins>
<plugin>
<groupId>com.xebialabs.xldeploy</groupId>
<artifactId>xldeploy-maven-plugin</artifactId>
<version>5.1.0</version>
<extensions>true</extensions>
<executions>
...
</executions>
<configuration>
<username>user-xyz</username>
<password>password-xyz</password>
<serverAddress>server-address</serverAddress>
<environmentId>Environments/app-1</environmentId>
<deployables>
************ start
<deployable>
<name>AD-role1</name>
<type>AD.AddRol</type>
<rol>role1,role2</rol>
</deployable>
************ end
Do you also have a document reference?
The XML code here instructs Maven to build a Deployment Archive for XL Deploy. The marked code is one element of the package, a deployable object of type AD.AddRol, to be deployed, I presume, to an AD server to create a role named AD-role-1, or perhaps roles named role1 and role2. This appears to be a custom extension to the XL Deploy product, so the deployment details must be inferred. See https://docs.xebialabs.com/xldeploy-maven-plugin/6.0.x/ for the plugin documentation. See https://docs.xebialabs.com/xl-deploy/ for general information about XL Deploy's model-based deployment type system.

xmlbeans classes created by maven are not placed in the right package structure

I'm using xmlbeans to generate some java classes. I'm using maven 3 in my project.
I have included the dependency and the plugin details as shown below.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
<configuration>
<schemaDirectory>src/main/xsd</schemaDirectory>
</configuration>
</plugin>
When I run a clean package goal I get compiler errors simply because the classes which uses the xmlbeans generated reference are not found in the classpath. This is because the xmlbeans classes are not compiled into the right directory structure. rather it just places it in the target\classes\aseXMLR30 (where as it should be in the formal structure ex: com.ex.first)
I have googled and read many blogs nothing helped me so far!
any replies/answers are really appreciated!
I know this question is 4 months old but in case you and/or others are still looking for a solution, this blog post may be able to provide a clue.
Essentially, what it says is that all references to org.maven.ide.eclipse should be replaced by org.eclipse.m2e. It references .launch files but to be on the safer side just grep recursively through your Eclipse directory and projects.

GWT won't deploy to Google

Everytime I try to deploy my program to the google app engine it shows me this error, I hae googled it and have received no good answer. Can someone please tell me what this error is and how to fix it.
Compiling module com.romero.chapthree.GAEJChapThree
[ERROR] Unexpected
java.lang.NoSuchFieldError: warningThreshold
at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:340)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.(JdtCompiler.java:174)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:616)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:193)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:390)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:275)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:299)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:529)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:466)
at com.google.gwt.dev.Compiler.run(Compiler.java:205)
at com.google.gwt.dev.Compiler.run(Compiler.java:177)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:149)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
at com.google.gwt.dev.Compiler.main(Compiler.java:156)
Try putting GWT classpath before any classpaths in your environment. Did you check this thread?
These days it appears you can fix it in the configuration of the gwt-maven plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.1.0-1</version>
<configuration>
...
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
</configuration>
https://code.google.com/p/google-web-toolkit/issues/detail?id=4479#c17
http://devnotesblog.wordpress.com/2011/04/23/maven-gwt-and-ecj/

Resources