Intellij idea, can't make Maven work - java

It's a copy of this post with adding information (because it's not a copy of another questions like this).
I just instaill last version of Intellij idea on the new computer and can't make Maven work properly with empty project.
When it starts Maven try to download all it's plugins, but it stuck in infinite download. I try to add some dependcy and get infinity download of that dependcy
I have found a lot of peoples with such problems like this and a lot of others, but this solution doesn't work for me.
I already install last version of Maven instead of Maven inserted in idea:
Also I try to update information from main repository manual in idea Maven settings and got such error:
transfer for nexus-maven-repository-index.properties failed
There is post with problem like this, but it doesn't work for me either.
And if I try to use Maven from Terminal like this:
mvn -U idea:idea
(also I try to add proxy settings as arguments here) I've got such problems:
Failed to retrieve plugin descriptor for
org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin
org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
And a lot of problems like this with other plugins.
Try to use proxy in settings.xml and as commands in idea settings of Maven:
As #Tunaki already said add of proxy helped in most of cases, but not mine.
My settings.xml:

I found the problem. The connection was being blocked my the computer's firewall. Turning off Windows Firewall and Avast Internet Security makes it work without any proxy.

Related

"Cannot find declaration to go" protos declaration in IntelliJ IDEA

I am trying to use gRPC proto file to generate stub code for inter-service communication. Everything is okay and when I run mvn clean install, it installs everything and builds successfully.
But still now protos files are in red color and can’t go definition when I click to go to it’s definition. It says me Cannot find declaration to go. When build is successful then why it is not possible to find declaration in IntelliJ IDEA?
I clean every cached on IDE and indexing is also successful. I also cleared m2 cache.
Is there anything to find this solution so that I can go to proto class definition?
Any help will be appreciated.
Thanks.
Your IntelliJ IDEA  needs to generate Project setup. So you need to execute the main plugin goal, which is idea:idea.
Use this command. It will helped me.
mvn -U idea:idea
Here
-U = Forces a check for missing releases and updated snapshots on remote repositories

Is there a way to replace a maven dependency formerly hosted by pyx4me.com?

i am trying to build a large java codebase that uses maven as it's build tool.
However, building (mvn clean install -DskipTests) always results in the following error:
[ERROR] Failed to execute goal com.pyx4j:maven-junction-plugin:1.0.3:unlink (unlink) on project flink-dist_2.10: Execution unlink of goal com.pyx4j:maven-junction-plugin:1.0.3:unlink failed: Plugin com.pyx4j:maven-junction-plugin:1.0.3 or one of its dependencies could not be resolved: Failed to collect dependencies for com.pyx4j:maven-junction-plugin:jar:1.0.3 (): Failed to read artifact descriptor for sysinternals:junction:exe:1.04: Could not transfer artifact sysinternals:junction:pom:1.04 from/to pyx4me-web (http://www.pyx4me.com/maven2): Connection to http://www.pyx4me.com refused: Connection refused (Connection refused) -> [Help 1]
I don't really know anything about maven, so i'm a litte lost on what to do.
I've tried to manually install the maven-junction-plugin in the local .m2 directory. However, that was before i understood that it's not the .jar that is missing, but some dependency of that jar.
I would be really grateful for any hints or insight from someone that knows anything about maven.
The problem you are having is the following: even though, the maven-junction-plugin artifact, version 1.0.3 is available in maven central repository, it tries to download a dependency called sysinternals:junction:exe:1.04 from (http://www.pyx4me.com/maven2) but the connection times out (You can also try to ping pyx4me.com and you will find out it is not responsive).
The maven-junction-plugin was in use by the Apache Flink before 1.2 Release.
The current stable versions of Apache Flink do not use it anymore. In fact the project seems abandonned and not supported anymore.
Please see the following maven's central Jira ticket asking for a removal of it from maven central.
So it looks like there is no simple way to do what you are trying to do.
But you might be able to hack a bit around it.
First it looks like systinternal:junction:1.04 is not available anywhere, but the 1.07 version is available here (it is possible that it won't be compatible with maven-junction-plugin 1.04, so you need to test it enough to make sure it is)
The zip contains the .exe in two flavors (a 32 and a 64 bits versions). Use the version that suits your need and install it in your local repository.
The general approach to install an artifact in your local repository would be the one described here, but since we are dealing with an .exe file you would rather use the procedure described here
Now let's assume that you have successfully installed the systinernal:junction:1.07 in your local repository with the following artifact properties:
groupId: your-group-id
artifactId: junction
version: 1.07
type: exe
You can use the jar installation in local repository approach to install the plugin's jar along with a customized version of the pom where you point to your local version of the systinternal:junction dependency instead of the original version. You can find both files here.
The dependencies section of your customized pom will then look like:
<dependencies>
<dependency>
<groupId>your-group-id</groupId>
<artifactId>junction</artifactId>
<version>1.07</version>
<type>exe</type>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
you can remove the old repositories section as the remote repository is not working anyway.
In my opinion, it is too much of a hacking (and you will probably have hard time convincing your colleagues to bring something like this in production). So I suggest to try to find an equivalent of the functionalities your are using this plugin for.

JUnit and other dependencies not recognized by CI build

Background:
So my team is using Microsoft's git services and we've set up some CI tests. We are not using Maven, and the project is connected to the remote server through the Eclipse Microsoft Team services plugin, but I try to interact with the remote repo mostly through the command line.
Current Strategy:
I'm not too familiar with how to deal with dependencies on a remote repo for Java projects but I've tried simply pushing the .jar dependencies in our build path with the rest of the source code (I know they're big and there's probably a better way to do this).
Problem:
When I push the .jar files, the CI tests still fail with the following errors:
src\JBLASTests.java(1):src\JBLASTests.java(1,): error : [javac] d:\a\1\s\
src\JBLASTests.java:1: error: package org.junit does not exist
src\JBLASTests.java(5):src\JBLASTests.java(5,): error : [javac] d:\a\1\s\
src\JBLASTests.java:5: error: package org.jblas does not exist
And then more error reports related to the missing symbols due to the packages not being found.
Questions:
1) What else needs to be on the repo to make the build work?
2) Is there a better way, besides Maven, to link the libraries to the repo?
(I'm not averse to using Maven I just want to find a simpler solution for the interim).
Apologies if this is a duplicate. I searched but couldn't find any other posts regarding this situation.
It looks like the dev who set up the CI tests set them up with an Ant build task despite that not being how we currently handle dependencies. Thank you howgler for pointing out that the CI might be building differently than I do locally. I'll post this answer in case anyone else runs into this issue and doesn't think to check the CI build settings (and also update the title appropriately).
Lesson
Make sure that the CI build task is the same as how you're building locally. Until you add dependencies and try to push them, your builds might be succeeding, so it can be misleading that your CI settings are incorrect.

Failure with Maven Android : The POM for com.google.android.gms:google-play-services:jar:13.0.0 is missing, no dependency information available

This is the error that I am getting with my current Maven Android Project.
The POM for com.google.android.gms:google-play-services:jar:13.0.0 is missing, no dependency information available
I have tried reinstalling google play services from SDK Manager and running mnv clean install still it does not work.
Any idea how to resolve this.
you need to make sure maven can access the repository the artifact can be found in. For example maven central http://search.maven.org/ does not contain the that artifact.
I would expect a settings.xml or a pom.xml to contain some section in that define where to look for this.
if you can execute maven commands try: mvn help:effective-settings
and as well: mvn help:effective-pom
that should reveal some repositories.
Another issue may be that you need to configure a proxy server for maven if you are behind one.
Is the message a warning or an error? Because it is also common that some artifacts do not have a pom.xml. So if it is a warning but everything else works just ignore it :)

Why do my tests fail to run when migrating from maven2 to buildr?

I have a straightforward maven2 java project (JMS relaying system). After we released the first version, we found that we spent more time configuring maven than actually coding.
For the next release we wanted to clean up the build process and someone suggested migrating to builder. So I was tasked with doing just that.
I setup buildr (1.3.4) according to the documentation on their website. And then from the root of the project I typed the buildr command and then informed buildr to create the build file based upon my pom.xml. That processed fine and compiled all the code. All was gravy until buildr started running the tests. Here is the ouput:
Test framework error: taskdef class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask cannot be found
Obviously the class specified isn't in my classpath. However, the buildr documentation says that all the required items needed for basic testing are included. Their documentation doesn't say that they need any specific libraries for ant or a version of ant. Although I do have ant 1.7.0 installed (not included in my classpath however).
Has anyone seen this before?
Update
I located the infamous ant-optional jar on the maven repository. Including that in my test.with options did not resolve the issue.
Running the buildr command with --trace gives this extra information...
Tests failed!
/pathtoruby/buildr-1.3.4/lib/buildr/core/test.rb:455:in `run_tests'
/pathtoruby/buildr-1.3.4/lib/buildr/core/test.rb:199:in `initialize'
Found the issue... Apparently there is an ant-junit.jar that is needed but for whatever reason in my local repository it was owned by root and not my local user account (OSX system). So it wasn't accessible to buildr. I deleted the items from my local repository and reran buildr (it downloaded the needed items).
Update
Also this caused a few other issues. It seems that a few other items in my local repository had strange permissions. I ended up just archiving my repository and letting maven reconstruct it. This resolved all my issues. I now have a nice build file that is 25 lines of code compared to my previous pom.xml file that was over 100 lines.
You get that error because JUnitTask isn't on the classpath. I'm not very familiar with Buildr so can't say if it is required for you to specify the JUnit jars or not, but if Buildr uses the system classpath, try adding JUnit to it and see what happens.
Once you've confirmed your builds will run with JUnit hacked in to the classpath, you can then try varying your configuration until it runs as you expected, or leave it as is.
Can you post the reference to the relevant part of the documentation? I didn't see anything (in my very brief reading of the site) that says required items are included.
Is it possible that you've not downloaded all the gems? If you run "gem update --system" to update Ruby, then "gem update buildr" you can ensure that the required dependencies have all been installed.

Categories