Possible bug - Not able to create production package behind a proxy

Hi,
I downloaded the https://vaadin.com/start/latest/project-base-spring and tried to build it with production-mode “mvn clean package -P production-mode”. I am behind a proxy but my maven settings.xml file contains the necessarily configuration. Everything is working fine - the packages are being downloaded etc. until “package-for-production” is executed:

[INFO]
Changes detected - recompiling the module!

[INFO]
Compiling 3 source files to D:\vaadinStarter\projectBaseSpring11\target\classes

[INFO]
— vaadin-maven-plugin:11.0.2:package-for-production (default) @ projectbasespring11 —

[WARNING]
The translated URL ‘frontend://bower_components/vaadin-upload/theme/lumo/vaadin-upload-file.html’ has no corresponding file on the filesystem, the file is addressed by path=‘D:\vaadinStart
er\projectBaseSpring11\target\frontend\bower_components\vaadin-upload\theme\lumo\vaadin-upload-file.html’

[INFO]
Installing required frontend tools to ‘D:\vaadinStarter\projectBaseSpring11\target’

[INFO]
Installing node version v8.11.1

[INFO]
Downloading https://nodejs.org/dist/v8.11.1/win-x64/node.exe to D:\vaadinStarter\projectBaseSpring11\target\cache\node-v8.11.1-win-x64.exe

[INFO]
No proxies configured

[INFO]
No proxy was configured, downloading directly

[INFO]

[INFO]
BUILD FAILURE

[INFO]

[INFO]
Total time: 05:00 min

[INFO]
Finished at: 2018-11-21T12:47:41+01:00

[INFO]

[ERROR]
Failed to execute goal com.vaadin:vaadin-maven-plugin:11.0.2:package-for-production (default) on project projectbasespring11: Execution default of goal com.vaadin:vaadin-maven-plugin:11.0.2:
package-for-production failed: Failed to install required frontend dependencies: Could not download Node.js from: https://nodejs.org/dist/v8.11.1/win-x64/node.exe: Could not download https://nodejs.
org/dist/v8.11.1/win-x64/node.exe: Connect to nodejs.org:443 [nodejs.org/104.20.23.46, nodejs.org/104.20.22.46]
failed: Connection timed out: connect → [Help 1]

[ERROR]
To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR]
Re-run Maven using the -X switch to enable full debug logging.

[ERROR]
For more information about the errors and possible solutions, please read the following articles:

[ERROR]
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

It seems that vaadin-maven-plugin does not recognize maven proxy configuration.

Br,
Szymon

Hello Szymon,

On Vaadin 12 it is possible to autodetect those dependencies by adding <autodetectTools>true</autodetectTools> into <configuration> section of the plugin.

Alternatively, both <yarnPath> and <nodePath> can be specified, that should work since Vaadin 11

Here there is an example of a project (Vaadin10) that uses the local node and yarn. it uses the version 1.1.0.beta4 of the flow-maven-plugin.

https://github.com/DiegoSanzVi/example-flow-maven-plugin

Hi Diego,
thank you very much for help!

Br,
Szymon

Hi,

Did you build your project in production mode ?

I’ve got a proxy and to use it I need to configure which websites are allowed.

For maven repository it’s easy.
But for production mode, I need to download node + yarn (or add it locally) then yarn need some other stuff (download other dependencies) and I don’t know which websites have to be allowed.

Is there a list of which websites should be allowed ?

Thanks,

The vaadin maven plugin installs the required frontend tools using yarn install.

yarn install is used to install all dependencies for a project. The dependencies are retrieved from your project’s package.json file, and stored in the yarn.lock file.

If you want to see the dependencies that are installed by yarn you can check those 2 files. They can be found inside the target directory.

Here is the code that it is used to install the dependencies:

public void installFrontendTools(int networkConcurrency) {
	LOGGER.info("Installing required frontend tools to '{}'",
			workingDirectory);
	createFileFromTemplateResource("package.json", Collections.emptyMap());
	createFileFromTemplateResource("yarn.lock", Collections.emptyMap());
	try {

		StringBuilder args = new StringBuilder("install");
		if (networkConcurrency >= 0) {
			args.append(" --network-concurrency ");
			args.append(networkConcurrency);
		}
		runnerManager.getYarnRunner().execute(args.toString(),
				Collections.emptyMap());
	} catch (TaskRunnerException e) {
		throw new IllegalStateException(
				"Failed to install required frontend dependencies", e);
	}
}

This code can be found here:

https://github.com/vaadin/flow/blob/e7115e3dafe9327ae3bb4b86fdbc1647413e7776/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/common/FrontendToolsManager.java

Here you can find more information about the
[vaadin maven plugin]
(https://vaadin.com/docs/v12/flow/production/tutorial-production-mode-advanced.html).

In the case of having a proxy, It is necessary to set the ignoreMavenProxies plugin property to true.

Hi Diego Sanz Villafruela,
thank you again. After adding ignoreMavenProxies everything work fine behind proxy.

Br,
Szymon

Hi, I have a similar problem.
I’m also behind an proxy but my settings.xml contains the configuration for the proxy.
When I execute the maven command “mvn package -P production-mode” I get the following error:

[INFO]
 --- vaadin-maven-plugin:12.0.7:package-for-production (default) @ base-starter ---
[WARNING]
 The translated URL 'frontend://bower_components/vaadin-upload/theme/lumo/vaadin-upload-file.html' has no corresponding file on the filesystem, the file is addressed by path='C:\Projects\base-starter\target\frontend\bower_components\vaadin-upload\theme\lumo\vaadin-upload-file.html'
[ERROR]
 Command '[where, yarn]
' exited with non-zero exit code: 1. stdout:
'1'
stderr:
'INFORMATION: Es konnten keine Dateien mit dem angegebenen
Muster gefunden werden.'
[INFO]
 Installing Yarn version v1.6.0
[INFO]
 Downloading https://github.com/yarnpkg/yarn/releases/download/v1.6.0/yarn-v1.6.0.tar.gz to C:\Projects\base-starter\target\cache\yarn-v1.6.0.tar.gz
[INFO]
 Downloading via proxy id1{protocol='http', host='10.43.214.104', port=8080, with username/passport authentication}
Feb. 26, 2019 4:06:58 NACHM. org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse
WARNUNG: NEGOTIATE authentication error: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt))
Feb. 26, 2019 4:06:58 NACHM. org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse
WARNUNG: NTLM authentication error: Credentials cannot be used for NTLM authentication: org.apache.http.auth.UsernamePasswordCredentials
[INFO]
 ------------------------------------------------------------------------
[INFO]
 BUILD FAILURE
[INFO]
 ------------------------------------------------------------------------
[INFO]
 Total time: 10.276 s
[INFO]
 Finished at: 2019-02-26T16:06:58+01:00
[INFO]
 Final Memory: 28M/104M
[INFO]
 ------------------------------------------------------------------------
[ERROR]
 Failed to execute goal com.vaadin:vaadin-maven-plugin:12.0.7:package-for-production (default) on project base-starter: Execution default of goal com.vaadin:vaadin-maven-plugin:12.0.7:package-for-production failed: Failed to download yarn: Could not download Yarn: Got error code 407 from the server. -> [Help 1]

[ERROR]
 
[ERROR]
 To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
 Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
 
[ERROR]
 For more information about the errors and possible solutions, please read the following articles:
[ERROR]
 [Help 1]
 http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

My configuration-Element for the vaadin-maven-plugin looks like this:

<configuration>
	<autodetectTools>true</autodetectTools>
	<ignoreMavenProxies>false</ignoreMavenProxies>
</configuration>

Any idea what causes this problem?

And if you set <ignoreMavenProxies> to true?

If I set the <ignoreMavenProxies> to true I get the following error:

[INFO]
 Installing required frontend tools to 'C:\Projects\base-starter\target'
[INFO]
 Running 'yarn install' in C:\Projects\base-starter\target
[INFO]
 yarn install v1.6.0
[INFO]
 [1/4]
 Resolving packages...
[INFO]
 [2/4]
 Fetching packages...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info If you think this is a bug, please open a bug report with the information provided in "C:\\Projects\\base-starter\\target\\yarn-error.log".
[ERROR]
 error An unexpected error occurred: "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND mmain mmain:80".
[INFO]
 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[INFO]
 ------------------------------------------------------------------------
[INFO]
 BUILD FAILURE
[INFO]
 ------------------------------------------------------------------------
[INFO]
 Total time: 25.054 s
[INFO]
 Finished at: 2019-02-27T09:06:59+01:00
[INFO]
 Final Memory: 25M/94M
[INFO]
 ------------------------------------------------------------------------
[ERROR]
 Failed to execute goal com.vaadin:vaadin-maven-plugin:12.0.7:package-for-production (default) on project base-starter: Execution default of goal com.vaadin:vaadin-maven-plugin:12.0.7:package-for-production failed: Failed to install required frontend dependencies: 'yarn install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

[ERROR]
 
[ERROR]
 To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
 Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
 
[ERROR]
 For more information about the errors and possible solutions, please read the following articles:
[ERROR]
 [Help 1]
 http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Then you might need to use your own installation of node and yarn, as mentioned above.

@Roland:
If you are behind a corporate FW, you will need to set ignoreMavenProxies to false!
Otherwise, you won’t get node and yard downloaded.

Your log also said, that your proxy needs NTLM_Authentication.

Feb. 26, 2019 4:06:58 NACHM. org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse
WARNUNG: NTLM authentication error: Credentials cannot be used for NTLM authentication: org.apache.http.auth.UsernamePasswordCredentials

So, it’s not possible to set username and password for proxy-authentication in your settings.xml.
You will need to update your proxy-configuration to use NTLM-Authentication!

How to do this in MVN’s settings.xml is described here:

https://codepen.io/ugbandula/post/how-to-configure-maven-to-work-with-ntlm-proxies

Jürgen

@Roland:
If you are behind a corporate FW, you will need to set ignoreMavenProxies to false!
Otherwise, you won’t get node and yard downloaded.

Your log also said, that your proxy needs NTLM_Authentication.

Feb. 26, 2019 4:06:58 NACHM. org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse
WARNUNG: NTLM authentication error: Credentials cannot be used for NTLM authentication: org.apache.http.auth.UsernamePasswordCredentials

You will need to update your proxy-configuration to use NTLM-Authentication!

How to do this in MVN’s settings.xml is described here:

https://codepen.io/ugbandula/post/how-to-configure-maven-to-work-with-ntlm-proxies

Jürgen

Have you managed to fix this? I also get the same error:

[INFO]
 Installing required frontend tools to 'C:\Javawork\vaadin_workspace_10\test\test-ui\target'
[INFO]
 Running 'yarn install --https-proxy=http://cache:80 --proxy=http://cache:80' in C:\Javawork\vaadin_workspace_10\test\test-ui\target
[INFO]
 yarn install v1.6.0
[ERROR]
 (node:7276) [DEP0005]
 DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[INFO]
 [1/4]
 Resolving packages...
[INFO]
 [2/4]
 Fetching packages...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[INFO]
 info There appears to be trouble with your network connection. Retrying...
[ERROR]
 error An unexpected error occurred: "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz: tunneling socket could not be established, cause=socket hang up".
[INFO]
 info If you think this is a bug, please open a bug report with the information provided in "C:\\Javawork\\vaadin_workspace_10\\test\\test-ui\\target\\yarn-error.log".
[INFO]
 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

and the log file states:

  Error: https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz: tunneling socket could not be established, cause=socket hang up

although everything else is being downloaded through proxy…