IntelliJ HTTP-Proxy works but fails at gradle dependencies - intellij-idea

so currently at work I face the problem, that I cannot build projects, which use global dependencies. We use an auto-config proxy script, which I already set in the File->Settings->Appearance & Behaviour->System Settings->HTTP Proxy and tested with the Check Connection-function.
The check connection function is working for any arbitrary html and also for the needed gradle-file (jcenter.bintray.com/com/android/tools/build/gradle/2.0.0/gradle-2.1.0-javadoc.jar).
For solutions I already tried to:
set the Proxy Information into the gradle.properties
tried to set http and/or https proxy settings
* systemProp.http(s).proxyHost=linktoproxyconfig.org
* systemProp.http(s).proxyPort=xxxx
* systemProp.http(s).proxyUser=xxxx
* systemProp.http(s).proxyPassword=xxxx
changing the repository direction (jcenter() vs. jcenter{url http://jcenter.bintray.com}
I am aware of the fact, that one can work offline, downloading the gradle locally. But to prevent the additional maintenance of gradle versions on different machines I would like to restrain from the work offline option.
Edit: Maybe I should also add the error message:
Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
I would be most grateful if someone has an idea about a solution.

IntelliJ IDEA 2017.3 does not seem to respect the proxy options for downloading Gradle. So add the proxy options to both gradle.properties and gradle-wrapper.properties, and then run ./gradlew in a terminal. This will download Gradle. After that, IntelliJ will work.

It also happend to me and the problem was that Gradle installation was wrong. I added a GRADLE_HOME environment variable and appended %GRADLE_HOME%/bin to PATH. I restarted the IDE and it worked! :)
Source: https://docs.gradle.org/current/userguide/installation.html#sec:installation_environment_variables

Another possible caveat:
Check if your environment variables for GRADLE_USER_HOME is set. Gradle will look for the gradle.properties in this directory.

I am facing the same problem because I using the proxy in Windows 10. Going to set the auto dectect the proxy fixed the connection timeout problem:
version IntelliJ IDEA 2022.1.2 (Community Edition).

Related

Mulesoft Transform Message Error: "There are some error in the current classpath"

New to working with MuleSoft, and I am getting an error "There are some error in the current classpath" when adding in a Transform Message into the Message Flow. I have just finished setting up Anypoint Studio, so this might be a configuration step I have missed somewhere.
DW Script Error
Payload (default)
I also faced the same issue and i follow below mentioned steps,
Go to the project Right Click > Mule > Update Project Dependencies
Note:- Before performing above steps make sure, you are connected with internet.
Hope it will work for you.
I had the same issue this morning and after a lot of playing around have finally managed to get it working. What did the trick in the end was to go to Project -> Properties -> Java Build Path, click on the Mule Server 3.7.2 EE entry, hit Edit, reselect the same version of the server runtime, click Finish, click Ok. This in itself didn't seem to make any difference, but then I restarted Anypoint Studio and everything was now working correctly.
I have done some digging, and found the following difference in the projects .classpath file:
before:
<classpathentry kind="con" path="MULE_RUNTIME"/>
after:
<classpathentry kind="con" path="MULE_RUNTIME/org.mule.tooling.server.3.7.2.ee"/>
Hopefully this works for you too.
Right click the project --> go to the properties --> select the required java version and any domain projects --> remove any un-referenced java version/domain from Java build path.
Check once if MAVEN_HOME is added as environment variable and %MAVEN_HOME%\bin is added to path variable in environment variables.
Also try deleting the .mule file created in the workspace and then try restarting Anypoint Studio. After that in command prompt traverse till your project folder and run mvn clean install command.

How to run WildFly with standalone-full.xml from IntelliJ IDEA?

I'm trying to run Wildfly 8.0 from Intellij IDEA. When starting WildFly through commmand-line I can use the -c standalone-full.xml parameter to use the standalone-full.xml configuration file. How can I specify this when running WildFly from Intellij IDEA?
In my opinion switch -c standalone-full.xml is not a VM Option so I will post a little bit different solution:
In the Run/Debug configuration for your server in the tab Startup/Connection you have the ability to set Startup script: On the end of line there is checkbox Use default. Please unselect it and paste on the end of the input -c standalone-full.xml
Adding -Djboss.server.default.config=standalone-full.xml to VM_OPTIONS is the equivalent of running standalone -c standalone-full.xml from a shell
As said by Mike Holdsworth -Djboss.server.default.config=standalone-full.xml works perfectly.
But there is another advantage over the -c standalone-full.xml method.
When you rename your standalone.xml file to create custom configuration files for multiple environments. Like env1.xml, env2.xml, etc.
If you use -c env1.xml, Intellij will give you the following message:
Error: HTTP management port configuration not found.
So you have to put a basic standalone.xml who will be overriden at the startup by the one you give with the -c option.
The -Djboss.server.default.config=env1.xml will prevent it.
Look out for different startup scripts for "Run" and "Debug" in Intellij IDEA. If you don't uncheck "Use default" in both of them then you can end up with two different profiles on "Run" and "Debug". It is easy to forget and annoying to figure it out.
If you want to run it by default w/o passing any command line parameters than go
to standalone.(bat|sh)
Append to the SERVER_OPTS variable: --server-config=standalone-full.xml
At least now you'll run it in full mode from any place (ide, service, command line)
I'm on a cross-platform team and we share our run configs. Modifying the startup script could cause problems (other teammate's paths and startup scripts are different), so my solution was:
Made a backup of standalone.xml
Renamed standalone-full.xml to standalone.xml
This doesn't answer the OP's question directly, but may be helpful for folks.
In the Run/Debug configuration for your server you have the ability to set VM options. You can put your switch in there. You may have problems however with jboss identifying the correct path for the file, so you may have to play with that a little bit before it works for you.
Run -> Edit configurations -> Click '+' in the top left corner -> JBoss Server -> Local
There you can configure your JBoss instance and set VM options and so on.

Play 2 & Cloudbees: Could not resolve substitution to a value

I am deploying my Play! 2.1 application on Cloudbees.
I have in my application.conf:
# Database configuration
# ~~~~~
db.default.driver=com.mysql.jdbc.Driver
db.default.url=${MYSQL_URL_DB}
db.default.user=${MYSQL_USERNAME_DB}
db.default.password=${MYSQL_PASSWORD_DB}
I defined those values in Cloudbees configuration:
$ bees config:list -a myself/my-app
Application Parameters:
proxyBuffering=false
MYSQL_URL_DB=jdbc:cloudbees://my-app
MYSQL_USERNAME_DB=my-app
MYSQL_PASSWORD_DB=yummy
Runtime Parameters:
java_version=1.7
I publish my app using git (git push cloudbees cloudbees:master) which triggers Jenkins. But when it comes to deploying application, I get in Jenkins logs:
[error] (compile:compile)
com.typesafe.config.ConfigException$UnresolvedSubstitution:
conf/application.conf: 16: Could not resolve substitution to a value:
${MYSQL_PASSWORD_DB}
Is there anything else to do to make Jenkins aware of the configuration? Did I misunderstand something?
Thanks for your help!
Alban
You can add "?" to the beginning, so it will be treated as an override.
db.default.url=${?MYSQL_URL_DB}
You can also handle fallback situations with this approach, if you like.
db.default.url=mysql://fallback_url
db.default.url=${?MYSQL_URL_DB}
If MYSQL_URL_DB does not exist, fallback_url will be used.
This configuration is injected at runtime, not build time. You have to find a way to make the sbt build ignore unresolved substitution.
It seems a possible workaround is to set MYSQL_URL_DB=foo, etc as build environment variables, so that the check don't break, as they won't be actually injected in your configuration
I use a config like this:
https://github.com/CloudBees-community/play2-clickstart/blob/master/conf/application.conf
and a build command like this:
java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar /opt/sbt/sbt-launch-0.11.3-2.jar -Dsbt.log.noformat=true clean compile test dist
And it does not worry about the missing environment variables.
My guess is that there is a scala macro or something that triggers the compiler to resolve those variables. Adding them in is fine.
I have amended the clickstart to set default values in case they are needed.

How to debug a maven goal with intellij idea?

Can you debug a maven goal with Intellij IDEA? I know that I can right-click and run Debug. However, the maven plugin does not appear in my External Libraries list, so I can not go into the code and set a breakpoint. Thus, Debug runs through the goals without stopping, like Run does.
I am using OS X 10.8 and IDEA 12.0.2.
EDIT: Goal
I've written custom specRunner for https://github.com/searls/jasmine-maven-plugin - However, $specs$ stays empty. So I try to see which files are actually loaded.
Figured it out:
from the command line, run maven goal with mvnDebug instead of mvn. E.g. mvnDebug clean
Open the source of the maven plugin you want to debug in intelliJ and set a breakPoint
In IDEA, add a Remote JVM Debug Configuration.
Under Settings, set Transport: Socket, Debugger Mode: Attach, Host: localhost, Port: 8000 (default port of mvnDebug).
Run the Configuration in Debug mode. It should connect to the waiting mvnDebug jvm.
Very easy. I am using Intellj Idea 15.0.4
Set the breakpoint in your maven plugin
In the tag "Maven Projects" go to the project witch is using your maven plugin.
In "Plugins" find your plugin and over the goal right click and Debug
Here is a screenshot:
Old question, but I was having the same need and it took me a while to get it to work. Hopefully can help someone.
For test debugging use:
mvn <goal> -Dmaven.surefire.debug
or
mvn <goal> -Dmaven.failsafe.debug
When execution stops and listens to socket at address 5005 (default) you run your configured remote debugger.
How to configure it:
Run -> Edit configurations -> Remote
Transport: socket
Debugger mode: Attach
Port: 5005 (default)
-> Save.
I think the easiest solution is to temporarily add the maven plugin as a dependency. Once this is done, IntelliJ will treat this just like any other dependency and you can set breakpoints the usual way.
The easiest way to debug maven goal ONLY within IntelliJ is to create a regular maven goal and in the runner tab pass those VM options:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
Where 8000 is a port number for remote debugging.
Then create new Remote configuration with port 8000. Run this configuration after running maven goal.
No need to setup up Java Remote Debugger or anything like that. It is literally just a right click -> debug on the Maven goal now, as explained in the official docs.
Either You can refer to above answer Or just add this plugin to pom.xml
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
</jvmArguments>
</configuration>
</plugin>
And run maven goal with mvn instead of mvnDebug. E.g. mvn spring-boot:run
In IDEA, add a Remote Configuration.
Under Settings, set Transport: Socket, Debugger Mode: Attach, Host: localhost, Port: 8000 (default port of mvnDebug).
Run as Debug in IDEA , whenever you want to debug the code.
Since you are working with Intellij, there is already a built-in debugger there and you do not need to necessarily use mvnDebug which is a command line tool. Check out this tutorial: How to Debug Maven Applications in Intellij IDEA.
The tutorial uses the Maven Exec Plugin and lets you debug the application without a need to use the command line or MvnDebug. Thought sharing it might be of value here.
#Peter Szanto 's answer work for me, but I don't like mess my source code.
And I can't make those MvnDebug way work.
So I try another way, add plugin source as IDEA module.
Here is the detail step:
Clone the plugin source as an independent project.
In your project, go to File -> New -> Module from Exist Sources and add the plugin project you clone in step 1.
Now you can open the plugin source code and set some break point.
Run your maven goal as debug mode, it should stop at the break point.

Glassfish 3.1.2.2 in IDEA 11.1.4: "PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required"

I am trying to get our Mavenized web application up and running in a freshly installed IDEA 11.1.4 Ultimate (Windows 7) under a freshly unzipped Glassfish 3.1.2.2. I have done this many times in Eclipse, but am not familiar with IDEA.
I can build and deploy it just fine, but when I try to access pages with JSP-content I get:
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
The Glassfish Application Servers entry adds the javax.ejb.jar, javax.servlet-api.jar and javax.servlet.jsp-api.jar as libraries.
I have set the project SDK to point to a full JDK resulting in:
(which does not seem to include a jar with javac)
The IntelliJ tutorials I've found so far, does not mention this problem. My guess would be that the "please start using this JDK" information is not passed on to Glassfish, so it just picks up the system JRE.
What configuration step have I missed? I do not want to edit configuration files - I expect the IntelliJ plugin to do this if I know how to tell it to.
I got the same notification and just changed in admin port -> Configurations -> server-config -> JVM Settings -> Java Home as "C:\Program Files\Java\jdk1.8.0_72", and it started working.
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required.
I was getting same error after restarting my glassfish 4 server.When I am trying to access my deployed application it was saying to mention full JDK.
login to Glassfish admin console.(http://localhost:4848).
Go to Configuration---->server-config--->JVM Settings
Set the java home with your correct jdk home (ex:C:\Program Files (x86)\Java\jdk1.8.0_121).
Restart the server.
It will work fine.
Next solution helped me
source: http://alvinalexander.com/blog/post/java/fixing-glassfish-jdk-path-problem-solved
Find your asenv.bat file. C:\Program Files\glassfish-4.0\glassfish\config\asenv.bat
Open it in text editor and find strings like "set AS_ = blahblah"
Add this string there "set AS_JAVA=C:\Program Files\Java\jdk1.7.0_60" (print your own JDK path here). If string "set AS_JAVA= blahblah" already exists then just fix the path.
Add JDK_HOME\lib\tools.jar file to the JDK configuration Classpath.
However, the problem in your case may be different as Glassfish JDK is not taken from IntelliJ IDEA settings, this question may help:
How do I specify the jdk for a glassfish domain?