Connection Refused on maven compile - java

I'm getting an exception (java.net.ConnectException: Connection refused: connect.) when trying to compile a maven project using the jaxb2 plugin to generate the class by a wsdl provided by a url.
However, I can get this wsdl when get it by a browser.
Any ideas?
Thanks.

While you might be able to resolve the connection issues given the comments above, the error message shows a fundamental problem in your build. If your maven build downloads the WSDL each time it compiles, you don't have repeatable builds, as the WSDL can change each time it's accessed. While it might be convenient to alway load the latest WSDL, I'd recommend downloading the WSDL and add it to your src tree. Then your build will not break, if the WSDL changes. You need to take take, however, to manually update the WSDL if you want to support a newer version.

The instructions on how to setup a proxy in jaxb2: https://github.com/highsource/maven-jaxb2-plugin/wiki/Configuring-Proxies/c32d4e2af4ab9c1fd5b3d67fb559ec32affab745
I just put <useActiveProxyAsHttpproxy>true</useActiveProxyAsHttpproxy> in my configuration tag of plugin.
Also, I prev set the proxy on my maven settings.xml

I had the same error in a java project built with maven and. On compilation the plugin tries to get some sources on the net and my company had set up a proxy. So you have to configure correctly your settings.xml and add
<useActiveProxyAsHttpproxy>true</useActiveProxyAsHttpproxy>
to the configuration tag of the plugin causing the error in the pom.xml

Related

while adding poi -ooxml dependency in sts4 I am getting an error - cannot transfer

I am getting an error while adding poi - ooxlm dependency in my Rest assured project . I need to add Excel file interaction to handle data .
The error I am getting is "Could not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com org.eclipse.aether.transfer.ArtifactTransferException: Could
not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com at "
my pom.xml is
You don't show much of the relevant parts of your pom.xml; also including the relevant snippets as text is easier than a screenshot.
But org.apache.poi:poi-ooxml-lite is available on maven central, so that's where your project should look.
https://artifacts.apple.com/libs-snapshot does not resolve for me, this might be a company internal maven repository that you're using?
There are a few things you can check:
Open the file .m2\repository\org\apache\poi\poi-ooxml-lite\5.2.2\poi-ooxml-lite-5.2.2.jar.lastUpdated and check the error message for each repository. Check why it can't reach maven central; is it missing from the list or giving an error? This might be a company firewall/policy issue perhaps? Or is it giving an error on HTTPS/TLS protocol level?
Check with mvn help:effective-pom what your current listed (plugin) repositories are
Check if you can add maven central to your repositories list if it's missing somehow (should be included by default). Check if it's HTTP or HTTPS, only secure is supported now.
Check in your main maven repository which versions of this jar are available / mirrored, and depend on that version instead (if you can't get maven central to work).
Run your maven command with -X for debug mode to investigate further

Unknown error in maven pom.xml when using intelliJ

so I recently installed maven in my pc. Did a little maven project with the guide of an online course in Udemy but I didn't get to finish it. My problem here is when I try to open maven in IntelliJ, pom.xml looks like this and I'm scared that this might cause a problem when I start another project on web dev using Java, SpringBoot, and RestAPI. I'm new to this so I'm not sure what to fix and make sure I will not face any errors. Thank you so much and looking forward to your helpful response.
It can be known from the error message that the reason for this error is because you did not add a constraint file for the xml file, so IDEA is prompting you to add a constraint space for the xml file.
You should check the constraint format of maven's pom.xml file and add it to your pom.xml file.
Another thing to know is that IDEA will use the built-in maven by default instead of the maven you downloaded. If you want to use the maven you downloaded, you should go to the settings to modify the maven configuration. (Of course you can use maven that comes with IDEA).

Uploading local maven repository to archiva

I am setting up a local repository using Apache Archiva. After setting up now I need to copy the libraries that got downloaded into my local maven repository into archiva. Currently I am manually copying it but it is very tedious process and I am planning to automate it using some scripts. Is there any better approach to do this?
I'm trying to write a plugin for this here which is able to copy jars and poms for all dependencies in all Configurations (including transitive dependencies). You might be interested in this code
Note: I've got a failing test here because I can't currently get the parent pom xml via the Gradle API's. I raised a feature request in Gradle here
There's a suggestion on the issue to use the IvyPot plugin... I haven't tried this myself but might be worth a shot.

Intellij idea, can't make Maven work

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.

Request factory in GWT, Library dependencies

I am newbie for GWT,and trying to understand the GWT request factory.
Moreover,I have been trying to run a Demo example of request factory from below link:
https://github.com/MikeMitterer/RFSample/
When I import it in Eclipse, there are so many libraries which are missing.
Like repackaged-appengine etc.
Can anyone help me to understand request factory. and why this libraries are required?
Heck that's the problem when you don't use managed dependencies (with tools such as Maven, Gradle or Ivy), you have to download everything by hand and edit the paths in the configuration to point to your downloaded JARs.
This sample apparently runs on AppEngine, so you'll have to download the Google AppEngine SDK. The author downloaded it (and the GWT SDK) separately, rather than using the Eclipse plugins from the Google Plugin for Eclipse. When done, edit the build path to fix the dependencies.
Back to Request Factory (rather than this sample), all you need is:
in your Build Path: gwt-user.jar if you're build a GWT app, or requestfactory-client.jar if you're building a Java app (such as an Android client), along with validation-api-1.0.0.GA.jar (and validation-api-1.0.0.GA-sources.jar if you're building a GWT app)
in your WEB-INF/lib: requestfactory-server.jar or gwt-servlet.jar, along with validation-api-1.0.0.GA.jar (you shouldn't need to add them to your build path though, all the classes they contain are already in gwt-user.jar); you might need gwt-servlet-deps.jar in addition to gwt-servlet.jar (can't remember, try it out)
if you want to use bean validation, also include Hibernate Validator in your `WEB-INF/lib, but it's optional.
Configure annotation processing with requestfactory-apt.jar, see https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation
And some links to understand it:
http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html
http://blog.ltgt.net/gwt-211-requestfactory and http://blog.ltgt.net/gwt-211-requestfactory-part-ii
https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryMovingParts

Categories