问:
maven-dependency-plugin:2.8:copy - can't find artifact
I am trying to download an artifact from a Nexus server on Ubuntu 14.04, but maven can't find it:

```<code>org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact.
</code>```

On my local OS X machine, it works just fine and downloads the expected artifacts:

```<code>mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -X -Dartifact=com.myserver.myapp:myapp-backend:LATEST -DoutputDirectory=./ -Dmdep.useBaseVersion=true
</code>```

Which outputs the following

```Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-31-generic", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /root/.m2/settings.xml
[DEBUG] Using local repository at /root/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /root/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Using mirror nexus (https://test.myserver.com:8443/repository/maven-public) for apache.snapshots (http://repository.apache.org/snapshots).
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: org.apache.maven:standalone-pom:pom:1
[DEBUG] Tasks:   [org.apache.maven.plugins:maven-dependency-plugin:2.8:copy]
[DEBUG] Style:   Aggregating
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       org.apache.maven:standalone-pom:1
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [nexus (https://test.myserver.com:8443/repository/maven-public, releases)]
[DEBUG] Repositories (plugins)     : [nexus (https://test.myserver.com:8443/repository/maven-public, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <artifact>${artifact}</artifact>
  <local default-value="${localRepository}"/>
  <outputAbsoluteArtifactFilename default-value="false">${outputAbsoluteArtifactFilename}</outputAbsoluteArtifactFilename>
  <outputDirectory default-value="${project.build.directory}/dependency">${outputDirectory}</outputDirectory>
  <overWriteIfNewer default-value="true">${mdep.overIfNewer}</overWriteIfNewer>
  <overWriteReleases default-value="false">${mdep.overWriteReleases}</overWriteReleases>
  <overWriteSnapshots default-value="false">${mdep.overWriteSnapshots}</overWriteSnapshots>
  <prependGroupId default-value="false">${mdep.prependGroupId}</prependGroupId>
  <reactorProjects default-value="${reactorProjects}"/>
  <remoteRepos default-value="${project.remoteArtifactRepositories}"/>
  <silent default-value="false">${silent}</silent>
  <skip default-value="false">${mdep.skip}</skip>
  <stripClassifier default-value="false">${mdep.stripClassifier}</stripClassifier>
  <stripVersion default-value="false">${mdep.stripVersion}</stripVersion>
  <useBaseVersion default-value="false">${mdep.useBaseVersion}</useBaseVersion>
  <project default-value="${project}"/>
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] --- maven-dependency-plugin:2.8:copy (default-cli) @ standalone-pom ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
... some imports ...
[DEBUG] org.apache.maven.plugins:maven-dependency-plugin:jar:2.8:
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.9:compile
[DEBUG]       commons-cli:commons-cli:jar:1.0:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.9:compile
[DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[DEBUG]       org.apache.maven:maven-monitor:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-artifact-manager:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-repository-metadata:jar:2.0.9:compile
[DEBUG]    org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
[DEBUG]    org.apache.maven.reporting:maven-reporting-impl:jar:2.0.5:compile
[DEBUG]       org.apache.maven.doxia:doxia-core:jar:1.0:compile
[DEBUG]       org.apache.maven.shared:maven-doxia-tools:jar:1.0.2:compile
[DEBUG]          commons-io:commons-io:jar:1.4:compile
[DEBUG]       commons-validator:commons-validator:jar:1.2.0:compile
[DEBUG]          commons-beanutils:commons-beanutils:jar:1.7.0:compile
[DEBUG]          commons-digester:commons-digester:jar:1.6:compile
[DEBUG]          commons-logging:commons-logging:jar:1.0.4:compile
[DEBUG]          oro:oro:jar:2.0.8:compile
[DEBUG]          xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG]    org.apache.maven.doxia:doxia-sink-api:jar:1.0:compile
[DEBUG]    org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile
[DEBUG]       org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[DEBUG]       org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[DEBUG]       org.apache.velocity:velocity:jar:1.5:compile
[DEBUG]       org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile
[DEBUG]    org.codehaus.plexus:plexus-archiver:jar:2.3:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.9:compile
[DEBUG]    org.apache.maven.shared:file-management:jar:1.2.1:compile
[DEBUG]       org.apache.maven.shared:maven-shared-io:jar:1.1:compile
[DEBUG]          org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6:compile
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]       junit:junit:jar:3.8.1:compile
[DEBUG]    org.codehaus.plexus:plexus-io:jar:2.0.6:compile
[DEBUG]    org.apache.maven.shared:maven-dependency-analyzer:jar:1.4:compile
[DEBUG]       asm:asm:jar:3.3.1:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG]    org.apache.maven.shared:maven-dependency-tree:jar:2.1:compile
[DEBUG]       org.eclipse.aether:aether-util:jar:0.9.0.M2:compile
[DEBUG]    org.apache.maven.shared:maven-common-artifact-filters:jar:1.4:compile
[DEBUG]    org.apache.maven.shared:maven-invoker:jar:2.0.11:compile
[DEBUG]    commons-lang:commons-lang:jar:2.6:compile
[DEBUG]    commons-collections:commons-collections:jar:3.2.1:compile
[DEBUG]    classworlds:classworlds:jar:1.1:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG]   Included: org.apache.maven.plugins:maven-dependency-plugin:jar:2.8
[DEBUG]   Included: commons-cli:commons-cli:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:3.0
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-impl:jar:2.0.5
[DEBUG]   Included: org.apache.maven.doxia:doxia-core:jar:1.0
[DEBUG]   Included: org.apache.maven.shared:maven-doxia-tools:jar:1.0.2
[DEBUG]   Included: commons-io:commons-io:jar:1.4
[DEBUG]   Included: commons-validator:commons-validator:jar:1.2.0
[DEBUG]   Included: commons-beanutils:commons-beanutils:jar:1.7.0
[DEBUG]   Included: commons-digester:commons-digester:jar:1.6
[DEBUG]   Included: commons-logging:commons-logging:jar:1.0.4
[DEBUG]   Included: oro:oro:jar:2.0.8
[DEBUG]   Included: xml-apis:xml-apis:jar:1.0.b2
[DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-site-renderer:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7
[DEBUG]   Included: org.codehaus.plexus:plexus-velocity:jar:1.1.7
[DEBUG]   Included: org.apache.velocity:velocity:jar:1.5
[DEBUG]   Included: org.apache.maven.doxia:doxia-decoration-model:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-apt:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-fml:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-xdoc:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-xhtml:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-archiver:jar:2.3
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.9
[DEBUG]   Included: org.apache.maven.shared:file-management:jar:1.2.1
[DEBUG]   Included: org.apache.maven.shared:maven-shared-io:jar:1.1
[DEBUG]   Included: junit:junit:jar:3.8.1
[DEBUG]   Included: org.codehaus.plexus:plexus-io:jar:2.0.6
[DEBUG]   Included: org.apache.maven.shared:maven-dependency-analyzer:jar:1.4
[DEBUG]   Included: asm:asm:jar:3.3.1
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG]   Included: org.apache.maven.shared:maven-dependency-tree:jar:2.1
[DEBUG]   Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG]   Included: org.apache.maven.shared:maven-common-artifact-filters:jar:1.4
[DEBUG]   Included: org.apache.maven.shared:maven-invoker:jar:2.0.11
[DEBUG]   Included: commons-lang:commons-lang:jar:2.6
[DEBUG]   Included: commons-collections:commons-collections:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-dependency-plugin:2.8:copy from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:2.8:copy' with basic configurator -->
[DEBUG]   (s) artifact = ch.myserver.myapp:myapp-backend:LATEST
[DEBUG]   (s) local =        id: local
      url: file:///root/.m2/repository/
   layout: none

[DEBUG]   (f) outputAbsoluteArtifactFilename = false
[DEBUG]   (s) outputDirectory = /home/nino
[DEBUG]   (s) overWriteIfNewer = true
[DEBUG]   (s) overWriteReleases = false
[DEBUG]   (s) overWriteSnapshots = false
[DEBUG]   (f) prependGroupId = false
[DEBUG]   (f) reactorProjects = [MavenProject: org.apache.maven:standalone-pom:1 @ ]
[DEBUG]   (s) remoteRepos = [       id: nexus
      url: https://test.myserver.com:8443/repository/maven-public
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) silent = false
[DEBUG]   (s) skip = false
[DEBUG]   (s) stripClassifier = false
[DEBUG]   (s) stripVersion = false
[DEBUG]   (s) useBaseVersion = true
[DEBUG]   (f) project = MavenProject: org.apache.maven:standalone-pom:1 @
[DEBUG] -- end configuration --
[INFO] Configured Artifact: ch.myserver.myapp:myapp-backend:LATEST:jar
[DEBUG] Could not find metadata ch.myserver.myapp:myapp-backend/maven-metadata.xml in local (/root/.m2/repository)
[DEBUG] Skipped remote update check for ch.myserver.myapp:myapp-backend/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata ch.myserver.myapp:myapp-backend:1.0-SNAPSHOT/maven-metadata.xml in local (/root/.m2/repository)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.090s
[INFO] Finished at: Wed Nov 15 10:01:44 CET 2017
[INFO] Final Memory: 9M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact. Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] ch.myserver.myapp:myapp-backend:jar:LATEST
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] nexus (https://test.myserver.com:8443/repository/maven-public, releases=true, snapshots=false)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to find artifact.
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:265)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:171)
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:105)
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  ch.myserver.myapp:myapp-backend:jar:LATEST

from the specified remote repositories:
  nexus (https://test.myserver.com:8443/repository/maven-public, releases=true, snapshots=false)

    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:219)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:157)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:525)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:257)
    ... 24 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:213)
    ... 27 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:528)
    ... 31 more
[ERROR]
[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/MojoExecutionException
```

<p>My <code>settings.xml</code> in <code>/root/.m2/</code>:</p>

```<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>snapshots</id>
      <username>myusername</username>
      <password>mypassword</password>
   </server>
   <server>
      <id>releases</id>
      <username>myusername</username>
      <password>mypassword</password>
    </server>
  </servers>

  <mirrors>
     <mirror>
      <id>nexus</id>
      <url>https://test.myserver.com:8443/repository/maven-public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
</settings>
```

I also tried to specify the exact version instead of LATEST, but that does not work either.

Am I missing some files or configurations, or what may the problem be here?

答:
I found a solution. I needed to pass -U:

```<code> -U,--update-snapshots                  Forces a check for missing
                                        releases and updated snapshots on
                                        remote repositories
</code>```

So:

```<code>mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -X -U -Dartifact=com.myserver.myapp:myapp-backend:LATEST -DoutputDirectory=./ -Dmdep.useBaseVersion=true
</code>```

Body:
I am trying to download an artifact from a Nexus server on Ubuntu 14.04, but maven can't find it:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact.

On my local OS X machine, it works just fine and downloads the expected artifacts:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -X -Dartifact=com.myserver.myapp:myapp-backend:LATEST -DoutputDirectory=./ -Dmdep.useBaseVersion=true

Which outputs the following

Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-31-generic", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /root/.m2/settings.xml
[DEBUG] Using local repository at /root/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /root/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Using mirror nexus (https://test.myserver.com:8443/repository/maven-public) for apache.snapshots (http://repository.apache.org/snapshots).
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: org.apache.maven:standalone-pom:pom:1
[DEBUG] Tasks:   [org.apache.maven.plugins:maven-dependency-plugin:2.8:copy]
[DEBUG] Style:   Aggregating
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       org.apache.maven:standalone-pom:1
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [nexus (https://test.myserver.com:8443/repository/maven-public, releases)]
[DEBUG] Repositories (plugins)     : [nexus (https://test.myserver.com:8443/repository/maven-public, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <artifact>${artifact}</artifact>
  <local default-value="${localRepository}"/>
  <outputAbsoluteArtifactFilename default-value="false">${outputAbsoluteArtifactFilename}</outputAbsoluteArtifactFilename>
  <outputDirectory default-value="${project.build.directory}/dependency">${outputDirectory}</outputDirectory>
  <overWriteIfNewer default-value="true">${mdep.overIfNewer}</overWriteIfNewer>
  <overWriteReleases default-value="false">${mdep.overWriteReleases}</overWriteReleases>
  <overWriteSnapshots default-value="false">${mdep.overWriteSnapshots}</overWriteSnapshots>
  <prependGroupId default-value="false">${mdep.prependGroupId}</prependGroupId>
  <reactorProjects default-value="${reactorProjects}"/>
  <remoteRepos default-value="${project.remoteArtifactRepositories}"/>
  <silent default-value="false">${silent}</silent>
  <skip default-value="false">${mdep.skip}</skip>
  <stripClassifier default-value="false">${mdep.stripClassifier}</stripClassifier>
  <stripVersion default-value="false">${mdep.stripVersion}</stripVersion>
  <useBaseVersion default-value="false">${mdep.useBaseVersion}</useBaseVersion>
  <project default-value="${project}"/>
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] --- maven-dependency-plugin:2.8:copy (default-cli) @ standalone-pom ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
... some imports ...
[DEBUG] org.apache.maven.plugins:maven-dependency-plugin:jar:2.8:
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.9:compile
[DEBUG]       commons-cli:commons-cli:jar:1.0:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.9:compile
[DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[DEBUG]       org.apache.maven:maven-monitor:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-artifact-manager:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-repository-metadata:jar:2.0.9:compile
[DEBUG]    org.apache.maven.reporting:maven-reporting-api:jar:3.0:compile
[DEBUG]    org.apache.maven.reporting:maven-reporting-impl:jar:2.0.5:compile
[DEBUG]       org.apache.maven.doxia:doxia-core:jar:1.0:compile
[DEBUG]       org.apache.maven.shared:maven-doxia-tools:jar:1.0.2:compile
[DEBUG]          commons-io:commons-io:jar:1.4:compile
[DEBUG]       commons-validator:commons-validator:jar:1.2.0:compile
[DEBUG]          commons-beanutils:commons-beanutils:jar:1.7.0:compile
[DEBUG]          commons-digester:commons-digester:jar:1.6:compile
[DEBUG]          commons-logging:commons-logging:jar:1.0.4:compile
[DEBUG]          oro:oro:jar:2.0.8:compile
[DEBUG]          xml-apis:xml-apis:jar:1.0.b2:compile
[DEBUG]    org.apache.maven.doxia:doxia-sink-api:jar:1.0:compile
[DEBUG]    org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile
[DEBUG]       org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[DEBUG]       org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[DEBUG]       org.apache.velocity:velocity:jar:1.5:compile
[DEBUG]       org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile
[DEBUG]       org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile
[DEBUG]    org.codehaus.plexus:plexus-archiver:jar:2.3:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.9:compile
[DEBUG]    org.apache.maven.shared:file-management:jar:1.2.1:compile
[DEBUG]       org.apache.maven.shared:maven-shared-io:jar:1.1:compile
[DEBUG]          org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6:compile
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]       junit:junit:jar:3.8.1:compile
[DEBUG]    org.codehaus.plexus:plexus-io:jar:2.0.6:compile
[DEBUG]    org.apache.maven.shared:maven-dependency-analyzer:jar:1.4:compile
[DEBUG]       asm:asm:jar:3.3.1:compile
[DEBUG]       org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[DEBUG]    org.apache.maven.shared:maven-dependency-tree:jar:2.1:compile
[DEBUG]       org.eclipse.aether:aether-util:jar:0.9.0.M2:compile
[DEBUG]    org.apache.maven.shared:maven-common-artifact-filters:jar:1.4:compile
[DEBUG]    org.apache.maven.shared:maven-invoker:jar:2.0.11:compile
[DEBUG]    commons-lang:commons-lang:jar:2.6:compile
[DEBUG]    commons-collections:commons-collections:jar:3.2.1:compile
[DEBUG]    classworlds:classworlds:jar:1.1:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8
[DEBUG]   Included: org.apache.maven.plugins:maven-dependency-plugin:jar:2.8
[DEBUG]   Included: commons-cli:commons-cli:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:3.0
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-impl:jar:2.0.5
[DEBUG]   Included: org.apache.maven.doxia:doxia-core:jar:1.0
[DEBUG]   Included: org.apache.maven.shared:maven-doxia-tools:jar:1.0.2
[DEBUG]   Included: commons-io:commons-io:jar:1.4
[DEBUG]   Included: commons-validator:commons-validator:jar:1.2.0
[DEBUG]   Included: commons-beanutils:commons-beanutils:jar:1.7.0
[DEBUG]   Included: commons-digester:commons-digester:jar:1.6
[DEBUG]   Included: commons-logging:commons-logging:jar:1.0.4
[DEBUG]   Included: oro:oro:jar:2.0.8
[DEBUG]   Included: xml-apis:xml-apis:jar:1.0.b2
[DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-site-renderer:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7
[DEBUG]   Included: org.codehaus.plexus:plexus-velocity:jar:1.1.7
[DEBUG]   Included: org.apache.velocity:velocity:jar:1.5
[DEBUG]   Included: org.apache.maven.doxia:doxia-decoration-model:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-apt:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-fml:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-xdoc:jar:1.0
[DEBUG]   Included: org.apache.maven.doxia:doxia-module-xhtml:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-archiver:jar:2.3
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.9
[DEBUG]   Included: org.apache.maven.shared:file-management:jar:1.2.1
[DEBUG]   Included: org.apache.maven.shared:maven-shared-io:jar:1.1
[DEBUG]   Included: junit:junit:jar:3.8.1
[DEBUG]   Included: org.codehaus.plexus:plexus-io:jar:2.0.6
[DEBUG]   Included: org.apache.maven.shared:maven-dependency-analyzer:jar:1.4
[DEBUG]   Included: asm:asm:jar:3.3.1
[DEBUG]   Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG]   Included: org.apache.maven.shared:maven-dependency-tree:jar:2.1
[DEBUG]   Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG]   Included: org.apache.maven.shared:maven-common-artifact-filters:jar:1.4
[DEBUG]   Included: org.apache.maven.shared:maven-invoker:jar:2.0.11
[DEBUG]   Included: commons-lang:commons-lang:jar:2.6
[DEBUG]   Included: commons-collections:commons-collections:jar:3.2.1
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.9
[DEBUG]   Excluded: org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-dependency-plugin:2.8:copy from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-dependency-plugin:2.8, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:2.8:copy' with basic configurator -->
[DEBUG]   (s) artifact = ch.myserver.myapp:myapp-backend:LATEST
[DEBUG]   (s) local =        id: local
      url: file:///root/.m2/repository/
   layout: none

[DEBUG]   (f) outputAbsoluteArtifactFilename = false
[DEBUG]   (s) outputDirectory = /home/nino
[DEBUG]   (s) overWriteIfNewer = true
[DEBUG]   (s) overWriteReleases = false
[DEBUG]   (s) overWriteSnapshots = false
[DEBUG]   (f) prependGroupId = false
[DEBUG]   (f) reactorProjects = [MavenProject: org.apache.maven:standalone-pom:1 @ ]
[DEBUG]   (s) remoteRepos = [       id: nexus
      url: https://test.myserver.com:8443/repository/maven-public
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) silent = false
[DEBUG]   (s) skip = false
[DEBUG]   (s) stripClassifier = false
[DEBUG]   (s) stripVersion = false
[DEBUG]   (s) useBaseVersion = true
[DEBUG]   (f) project = MavenProject: org.apache.maven:standalone-pom:1 @
[DEBUG] -- end configuration --
[INFO] Configured Artifact: ch.myserver.myapp:myapp-backend:LATEST:jar
[DEBUG] Could not find metadata ch.myserver.myapp:myapp-backend/maven-metadata.xml in local (/root/.m2/repository)
[DEBUG] Skipped remote update check for ch.myserver.myapp:myapp-backend/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Could not find metadata ch.myserver.myapp:myapp-backend:1.0-SNAPSHOT/maven-metadata.xml in local (/root/.m2/repository)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.090s
[INFO] Finished at: Wed Nov 15 10:01:44 CET 2017
[INFO] Final Memory: 9M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact. Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR]
[ERROR] ch.myserver.myapp:myapp-backend:jar:LATEST
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] nexus (https://test.myserver.com:8443/repository/maven-public, releases=true, snapshots=false)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (default-cli) on project standalone-pom: Unable to find artifact.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to find artifact.
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:265)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:171)
    at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.doExecute(CopyMojo.java:105)
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:167)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=ch.myserver.myapp -DartifactId=myapp-backend -Dversion=LATEST -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  ch.myserver.myapp:myapp-backend:jar:LATEST

from the specified remote repositories:
  nexus (https://test.myserver.com:8443/repository/maven-public, releases=true, snapshots=false)

    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:219)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:157)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:525)
    at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:257)
    ... 24 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)
    at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:213)
    ... 27 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact ch.myserver.myapp:myapp-backend:jar:LATEST
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:528)
    ... 31 more
[ERROR]
[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/MojoExecutionException

My settings.xml in /root/.m2/:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>snapshots</id>
      <username>myusername</username>
      <password>mypassword</password>
   </server>
   <server>
      <id>releases</id>
      <username>myusername</username>
      <password>mypassword</password>
    </server>
  </servers>

  <mirrors>
     <mirror>
      <id>nexus</id>
      <url>https://test.myserver.com:8443/repository/maven-public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
</settings>

I also tried to specify the exact version instead of LATEST, but that does not work either.

Am I missing some files or configurations, or what may the problem be here?

Body:
I found a solution. I needed to pass -U:

 -U,--update-snapshots                  Forces a check for missing
                                        releases and updated snapshots on
                                        remote repositories

So:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy -X -U -Dartifact=com.myserver.myapp:myapp-backend:LATEST -DoutputDirectory=./ -Dmdep.useBaseVersion=true


来源: stackexchange

问:
Why do lots of (old) programs use floor(0.5 + input) instead of round(input)?
The differences reside in the returned value giving inputs around tie-breaking I believe, such as this code:

```<code>int main()
{
    std::cout.precision(100);

    double input = std::nextafter(0.05, 0.0) / 0.1;
    double x1 = floor(0.5 + input);
    double x2 = round(input);

    std::cout << x1 << std::endl;
    std::cout << x2 << std::endl;
}
</code>```

which outputs:

```<code>1
0
</code>```

But they are just different results in the end, one chooses its preferred one. I see lots of "old" C/C++ programs using floor(0.5 + input) instead of round(input).

Is there any historic reason? Cheapest on the CPU?

答:
I think this is where you err:

But they are just different results in the end, one chooses its
  preferred one. I see lots of "old" C/C++ programs using floor(0.5 +
  input) instead of round(input).

That is not the case.  You must select the right rounding scheme for the domain.  In a financial application, you'll round using banker's rules (not using float by the way). When sampling, however, rounding up using static_cast<int>(floor(f + .5)) yields less sampling noise, this increments the dynamic range.  When aligning pixels, i.e. converting a position to screen coordinates, using any other rounding method will yield holes, gaps, and other artifacts.

ContentLicense: CC BY-SA 3.0

Body:
The differences reside in the returned value giving inputs around tie-breaking I believe, such as this code:

int main()
{
    std::cout.precision(100);

    double input = std::nextafter(0.05, 0.0) / 0.1;
    double x1 = floor(0.5 + input);
    double x2 = round(input);

    std::cout << x1 << std::endl;
    std::cout << x2 << std::endl;
}

which outputs:

1
0

But they are just different results in the end, one chooses its preferred one. I see lots of "old" C/C++ programs using floor(0.5 + input) instead of round(input).

Is there any historic reason? Cheapest on the CPU?


问:
why "abc" + null results abcnull
why "abc" + null  results abcnull

```<code>String s1 = "abc";
String s2 = null;
String s3 = s1+ s2;

System.out.println(s3);
</code>```

Result: abcnull

答:
it is because any thing u add it with a string will by default convert it into a string.
and even if you try to add a number to a string it will be converted into string.
example:
"abc"+123="abc123"
there is a syntax called concat which will add only string to string not any thing else.
example :
if u type
"abc".concat(null)
then it will show
java.lang.NullPointerException
    at java.lang.String.concat(Unknown Source)
but if u type
"abc".concat("null")
the output will be "abcnull".</p>

ContentLicense: CC BY-SA 2.5

Title: why "abc" + null results abcnull

Body:
why "abc" + null  results abcnull

String s1 = "abc";
String s2 = null;
String s3 = s1+ s2;

System.out.println(s3);

Result: abcnull


问:
c# - itext7 - How to add text to new page?
I'm creating Pdfs using itext7. It allows me to add paragraphs to first page but I'm not sure how can I add content to second page. If I create Canvas after calling AddNewPage() then it works fine, but it doesn't work when I use a paragraph and I add it to the document. Thanks for help. In my example, firstPageText and secondPageText will be displayed on first page:</p>

```<code>protected void CreatePdf(string filePath, string firstPageText, string secondPageText)
   {
       PdfWriter writer = new PdfWriter(filePath);
       PdfDocument pdfDocument = new PdfDocument(writer);
       Document doc = new Document(pdfDocument);

       doc.Add(new Paragraph(firstPageText));
       pdfDocument.AddNewPage();
       doc.Add(new Paragraph(secondPageText));

       doc.Close();
   }
</code>```

答:
This is explained in chapter 2 of the iText 7: Building Blocks. Allow me to copy a snippet of that tutorial:

If we had used an AreaBreak of type NEXT_PAGE, a new page would have been started; see figure 2.11.

In the
  JekyllHydeV5
  example, we changed a single line:

```<code>AreaBreak nextPage = new AreaBreak(AreaBreakType.NEXT_PAGE);
</code>```

Instead of skipping to the next column, iText now skips to the next
  page.

By default, the newly created page will have the same page size as
    the current page. If you want iText to create a page of another
    size, you can use the constructor that accepts a PageSize object as
    a parameter. For instance: new AreaBreak(PageSize.A3).

There's also an AreaBreak of type LAST_PAGE. This AreaBreakType
  is to be used when switching between different renderers.

It surprises me that you'd do this:

```<code>doc.Add(new Paragraph(firstPageText));
pdfDocument.AddNewPage();
doc.Add(new Paragraph(secondPageText));
</code>```

While the documented way is to do it like this:

```<code>doc.Add(new Paragraph(firstPageText));
doc.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
doc.Add(new Paragraph(secondPageText));
</code>```

Body:
I'm creating Pdfs using itext7. It allows me to add paragraphs to first page but I'm not sure how can I add content to second page. If I create Canvas after calling AddNewPage() then it works fine, but it doesn't work when I use a paragraph and I add it to the document. Thanks for help. In my example, firstPageText and secondPageText will be displayed on first page:

protected void CreatePdf(string filePath, string firstPageText, string secondPageText)
   {
       PdfWriter writer = new PdfWriter(filePath);
       PdfDocument pdfDocument = new PdfDocument(writer);
       Document doc = new Document(pdfDocument);

       doc.Add(new Paragraph(firstPageText));
       pdfDocument.AddNewPage();
       doc.Add(new Paragraph(secondPageText));

       doc.Close();
   }

Body:
This is explained in chapter 2 of the iText 7: Building Blocks. Allow me to copy a snippet of that tutorial:

If we had used an AreaBreak of type NEXT_PAGE, a new page would have been started; see figure 2.11.

In the
  JekyllHydeV5
  example, we changed a single line:

AreaBreak nextPage = new AreaBreak(AreaBreakType.NEXT_PAGE);

Instead of skipping to the next column, iText now skips to the next
  page.

By default, the newly created page will have the same page size as
    the current page. If you want iText to create a page of another
    size, you can use the constructor that accepts a PageSize object as
    a parameter. For instance: new AreaBreak(PageSize.A3).

There's also an AreaBreak of type LAST_PAGE. This AreaBreakType
  is to be used when switching between different renderers.

It surprises me that you'd do this:

doc.Add(new Paragraph(firstPageText));
pdfDocument.AddNewPage();
doc.Add(new Paragraph(secondPageText));

While the documented way is to do it like this:

doc.Add(new Paragraph(firstPageText));
doc.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
doc.Add(new Paragraph(secondPageText));


问:
Understanding Tensor Inputs & Transformations for use in an LSTM (dynamic RNN)
I am building an LSTM style neural network in Tensorflow and am having some difficulty understanding exactly what input is needed and the subsequent transformations made by tf.nn.dynamic_rnn before it is passed to the sparse_softmax_cross_entropy_with_logits layer.

https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn

Understanding the input

The input function is sending a feature tensor in the form

[batch_size, max_time]

However the manual states that input tensors must be in the form

[batch_size, max_time, ...]

I have therefore expanded the input with a 1d tensor to take the form

[batch_size, max_time, 1]

At this point the input does not break upon running, but I don't understand exactly what we have done here and suspect it may be causing the problems when calculating loss (see below).

Understanding the Transformations

This expanded tensor is then the 'features' tensor used in the code below

```<code>LSTM_SIZE = 3
lstm_cell = rnn.BasicLSTMCell(LSTM_SIZE, forget_bias=1.0)
outputs, _ = tf.nn.dynamic_rnn(lstm_cell, features, dtype=tf.float64)

#slice to keep only the last cell of the RNN
outputs = outputs[-1]

#softmax layer

with tf.variable_scope('softmax'):
   W = tf.get_variable('W', [LSTM_SIZE, n_classes], dtype=tf.float64)
   b = tf.get_variable('b', [n_classes], initializer=tf.constant_initializer(0.0), dtype=tf.float64)

logits = tf.matmul(outputs, W) + b

loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=labels))
</code>```

This throws a value error at loss

dimensions must be equal, but are [max_time, num_classes] and [batch_size]

from https://www.tensorflow.org/versions/r0.12/api_docs/python/nn/classification -

A common use case is to have logits of shape [batch_size, num_classes] and labels of shape [batch_size]. But higher dimensions are supported.

At some point in the process max_time and batch_size have been mixed up and I'm uncertain if its at input or during the LSTM. I'm grateful for any advice!

答:
That is because of the shape of the output of the tf.nn.dynamic_rnn. From its documentation https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn:

outputs: The RNN output Tensor.

If time_major == False (default), this will be a Tensor shaped: [batch_size, max_time, cell.output_size].

If time_major == True, this will be a Tensor shaped: [max_time, batch_size, cell.output_size].

you are in the default case, so your outputs gas shape [batch_size, max_time, output_size], and when performing outputs[-1] you obtain a tensor with shape [max_time, output_size]. Probably slicing with outputs[:, -1] should fix it.

Body:
I am building an LSTM style neural network in Tensorflow and am having some difficulty understanding exactly what input is needed and the subsequent transformations made by tf.nn.dynamic_rnn before it is passed to the sparse_softmax_cross_entropy_with_logits layer.

https://www.tensorflow.org/api_docs/python/tf/nn/dynamic_rnn

Understanding the input

The input function is sending a feature tensor in the form

[batch_size, max_time]

However the manual states that input tensors must be in the form

[batch_size, max_time, ...]

I have therefore expanded the input with a 1d tensor to take the form

[batch_size, max_time, 1]

At this point the input does not break upon running, but I don't understand exactly what we have done here and suspect it may be causing the problems when calculating loss (see below).

Understanding the Transformations

This expanded tensor is then the 'features' tensor used in the code below

LSTM_SIZE = 3
lstm_cell = rnn.BasicLSTMCell(LSTM_SIZE, forget_bias=1.0)
outputs, _ = tf.nn.dynamic_rnn(lstm_cell, features, dtype=tf.float64)

#slice to keep only the last cell of the RNN
outputs = outputs[-1]

#softmax layer

with tf.variable_scope('softmax'):
   W = tf.get_variable('W', [LSTM_SIZE, n_classes], dtype=tf.float64)
   b = tf.get_variable('b', [n_classes], initializer=tf.constant_initializer(0.0), dtype=tf.float64)

logits = tf.matmul(outputs, W) + b

loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=labels))

This throws a value error at loss

dimensions must be equal, but are [max_time, num_classes] and [batch_size]

from https://www.tensorflow.org/versions/r0.12/api_docs/python/nn/classification -

A common use case is to have logits of shape [batch_size, num_classes] and labels of shape [batch_size]. But higher dimensions are supported.

At some point in the process max_time and batch_size have been mixed up and I'm uncertain if its at input or during the LSTM. I'm grateful for any advice!


问:
Integration Tests with PowerMock and Spring Boot
I'm doing some integration tests, on a Spring Boot application.

Usually the integration tests that I was used to develop, was regarding the application domain, without any external service involved.
Since this time I need to make an integration test on a service which uses both a database and an external service called by an SDK, I've tried doing something like the following:

```<code>@RunWith(PowerMockRunner::class)
@SpringBootTest
@PowerMockRunnerDelegate(SpringRunner::class)
@PrepareForTest(McpProductService::class)
class MyServiceIntegration {

    @Mock
    private ExternalService externalService;

    @Autowired
    @InjectMocks
    private MyServiceImpl myService;

    @Test
    public void thisTestShouldWork() {
        ...
    }
}
</code>```

What is confusing me is: how should I declare myService attribute? Usually when I use Mockito + PowerMock in my Unit Tests, I usually test the implementation, not the whole Service Interface + Spring Injection. But I can't use @Autowired if I'm using just it's implementation, not the Interface.

Is there any best practice for this issue that I'm facing?

答:
Disclaimer: I'm assuming that what you are after is an end-to-end test of a service interface, backed by multiple classes. I assume (and hope) that you don't have a single class handling both database and webservice integration.

I don't see the need to use PowerMock here, it is usually something one would use for testing legacy code with a lot of static stuff. If you are using Spring boot, your code should be of a quality that makes PowerMock unnecessary.

When writing an end-to-end test, the principles are the same as a per-class unit test, only with a larger scope:

With a unit test, you create an instance of the class under test, and mock all its external dependencies (other classes)

With an end-to-end test, you create an "instance" of your module under test, and mock its external dependencies.

So, here you should find a mechanism to mock the parts of your code that communicates with external sources, like web service clients, database classes (if you don't use an in-memory db for your test (you should)). This will typically be a Spring config that is almost identical to the one used in production, but with said parts mocked out. Then, you just @Inject the parts you need to communicate with in order to complete the test.

Assuming that you use component scan and annotations for all beans, you could mock the endpoint-classes and use profiles:

This code is based on memory only, might not work on copy-paste, but hopefully you could use the concepts..

```<code>@Profile("test")
@Configuration
public class TestConfiguration {
    @Bean
    @Primary
    public SomeWebserviceClient someWebserviceClient() {
        return mock(SomeWebserviceClient.class);
    }
}
</code>```

Production code:

```<code>@Service
public class SomeClass {
    @Inject
    private SomeWebserviceClient client;
}
</code>```

Then in the test:

```<code>@RunWith(PowerMockRunner::class)
@SpringBootTest
@ActiveProfiles("test")
public class SomeTest {
    @Inject
    private SomeClass someClass;

    @Inject
    private SomeWebserviceClient client; //<< will inject mock
}
</code>```

Mock will also be injected into SomeClass

Body:
I'm doing some integration tests, on a Spring Boot application.

Usually the integration tests that I was used to develop, was regarding the application domain, without any external service involved.
Since this time I need to make an integration test on a service which uses both a database and an external service called by an SDK, I've tried doing something like the following:

@RunWith(PowerMockRunner::class)
@SpringBootTest
@PowerMockRunnerDelegate(SpringRunner::class)
@PrepareForTest(McpProductService::class)
class MyServiceIntegration {

    @Mock
    private ExternalService externalService;

    @Autowired
    @InjectMocks
    private MyServiceImpl myService;

    @Test
    public void thisTestShouldWork() {
        ...
    }
}

What is confusing me is: how should I declare myService attribute? Usually when I use Mockito + PowerMock in my Unit Tests, I usually test the implementation, not the whole Service Interface + Spring Injection. But I can't use @Autowired if I'm using just it's implementation, not the Interface.

Is there any best practice for this issue that I'm facing?

Body:
Disclaimer: I'm assuming that what you are after is an end-to-end test of a service interface, backed by multiple classes. I assume (and hope) that you don't have a single class handling both database and webservice integration.

I don't see the need to use PowerMock here, it is usually something one would use for testing legacy code with a lot of static stuff. If you are using Spring boot, your code should be of a quality that makes PowerMock unnecessary.

When writing an end-to-end test, the principles are the same as a per-class unit test, only with a larger scope:

With a unit test, you create an instance of the class under test, and mock all its external dependencies (other classes)

With an end-to-end test, you create an "instance" of your module under test, and mock its external dependencies.

So, here you should find a mechanism to mock the parts of your code that communicates with external sources, like web service clients, database classes (if you don't use an in-memory db for your test (you should)). This will typically be a Spring config that is almost identical to the one used in production, but with said parts mocked out. Then, you just @Inject the parts you need to communicate with in order to complete the test.

Assuming that you use component scan and annotations for all beans, you could mock the endpoint-classes and use profiles:

This code is based on memory only, might not work on copy-paste, but hopefully you could use the concepts..

@Profile("test")
@Configuration
public class TestConfiguration {
    @Bean
    @Primary
    public SomeWebserviceClient someWebserviceClient() {
        return mock(SomeWebserviceClient.class);
    }
}

Production code:

@Service
public class SomeClass {
    @Inject
    private SomeWebserviceClient client;
}

Then in the test:

@RunWith(PowerMockRunner::class)
@SpringBootTest
@ActiveProfiles("test")
public class SomeTest {
    @Inject
    private SomeClass someClass;

    @Inject
    private SomeWebserviceClient client; //<< will inject mock
}

Mock will also be injected into SomeClass


问:
Bootstrap input and span inside td on the same line
I have a problem displaying input and span on the same line. They are inside first cell in the table.

What I've already tried is to use form-inline class, but both elements are still displayed in separate lines.

What am I doing wrong?

Code example from code pen.

Source:

```<code><table id="tblJEEVUG" class="table table-hover table-bordered table-striped table-condensed">
    <thead>
      <tr>
        <th>Datum</th>
        <th>Št. oseb</th>
        <th>Opomba</th>
        <th>Skupina</th>
        <th></th>
      </tr>
    </thead>
    <tbody>

            <tr data-ievug_key="170000536">

              <td id="devug_dst" style="width:200px;"><input class="form-control datetimepicker form-inline bounddtp" value="" style="width:70%;">
                <span id="spanOK" class="glyphicon glyphicon-ok form-inline" style="color: green; font-weight: bold; font-size: 20px; width: 5%;"></span></td>
              <td id="ievug_nop" style="width:50px;"><input class="form-control cbeh-number"></td>
              <td id="cevug_nto"><input class="form-control" value="zdaj pa en komnetar tule notri zapišem jaz"></td>
              <td id="igrop_key">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030">Oddelek za transport</option>
                      <option value="100000029">Catering strežba</option>
                      <option value="100000504" selected="">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>

              </td>
              <td style="vertical-align:middle;text-align:center;">
                <span class="glyphicon glyphicon-remove" title="Izbriši" style="color:red;cursor:pointer;display:block;" onclick="PopUpJEEVUS.RemoveRowJEEVUG(this);"></span>
              </td>

            </tr>
            <tr data-ievug_key="170000537">

              <td id="devug_dst" style="width:200px;"><input class="form-control datetimepicker form-inline bounddtp" value="15.11.2017 10:30" style="width:70%;">
                <span id="spanOK" class="glyphicon glyphicon-ok form-inline" style="color: green; font-weight: bold; font-size: 20px; width: 25%;"></span></td>
              <td id="ievug_nop" style="width:50px;"><input class="form-control cbeh-number" value="44"></td>
              <td id="cevug_nto"><input class="form-control" value="transtport pa bom dal en manjši komentar za tale transport sedaj"></td>
              <td id="igrop_key">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030" selected="">Oddelek za transport</option>
                      <option value="100000029">Catering strežba</option>
                      <option value="100000504">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>

              </td>
              <td style="vertical-align:middle;text-align:center;">
                <span class="glyphicon glyphicon-remove" title="Izbriši" style="color:red;cursor:pointer;display:block;" onclick="PopUpJEEVUS.RemoveRowJEEVUG(this);"></span>
              </td>

            </tr>
            <tr data-ievug_key="170000535">

              <td id="devug_dst" style="width:200px;"><input class="form-control datetimepicker form-inline bounddtp" value="16.11.2017 10:30" style="width:70%;">
                <span id="spanOK" class="glyphicon glyphicon-ok form-inline" style="color: green; font-weight: bold; font-size: 20px; width: 25%;"></span></td>
              <td id="ievug_nop" style="width:50px;"><input class="form-control cbeh-number" value="44"></td>
              <td id="cevug_nto"><input class="form-control" value="fffffffffffffffffffff"></td>
              <td id="igrop_key">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030">Oddelek za transport</option>
                      <option value="100000029" selected="">Catering strežba</option>
                      <option value="100000504">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>

              </td>
              <td style="vertical-align:middle;text-align:center;">
                <span class="glyphicon glyphicon-remove" title="Izbriši" style="color:red;cursor:pointer;display:block;" onclick="PopUpJEEVUS.RemoveRowJEEVUG(this);"></span>
              </td>

            </tr>

    </tbody>
  </table>
</code>```

答:
You must put the float: left; on input textboxes
Check here my example

Body:
I have a problem displaying input and span on the same line. They are inside first cell in the table.

What I've already tried is to use form-inline class, but both elements are still displayed in separate lines.

What am I doing wrong?

Code example from code pen.

Source:

        Datum
        Št. oseb
        Opomba
        Skupina

              <input class="form-control datetimepicker form-inline bounddtp" value="" style="width:70%;">

              <input class="form-control cbeh-number">
              <input class="form-control" value="zdaj pa en komnetar tule notri zapišem jaz">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030">Oddelek za transport</option>
                      <option value="100000029">Catering strežba</option>
                      <option value="100000504" selected="">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>

              <input class="form-control datetimepicker form-inline bounddtp" value="15.11.2017 10:30" style="width:70%;">

              <input class="form-control cbeh-number" value="44">
              <input class="form-control" value="transtport pa bom dal en manjši komentar za tale transport sedaj">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030" selected="">Oddelek za transport</option>
                      <option value="100000029">Catering strežba</option>
                      <option value="100000504">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>

              <input class="form-control datetimepicker form-inline bounddtp" value="16.11.2017 10:30" style="width:70%;">

              <input class="form-control cbeh-number" value="44">
              <input class="form-control" value="fffffffffffffffffffff">

                <select class="form-control" data-editable="1">
                  <option></option>
                      <option value="100000030">Oddelek za transport</option>
                      <option value="100000029" selected="">Catering strežba</option>
                      <option value="100000504">Catering vodje prireditve</option>
                      <option value="100000748">HKJ-odgovorni kuharji </option>
                      <option value="100000028">HKJ-kuharji </option>

                </select>


问:
out.print() is not working with jsp method
out object shows error like cannot find symbol. Tried many ways to fix the error. But it stil shows error

```<code><%@ page import="java.sql.*" %>
<%!
    void loadBuilding() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost/crm", "root", "");
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("select name from building where 1");
        rs.last();
        int count = rs.getRow();
        if (count > 0) {
            rs.beforeFirst();
            while (rs.next()) {
                out.print("<script>passName('" + rs.getString(1) + "');</script>");
            }
        } else {
            out.print("No Buildings Added Yet");
        }
    }
%>

<%
    loadBuilding();
%>
</code>```

答:
Based on the methods you are calling on out, you might need out to be a PrintWriter whose output is written to the OutputStream of the response generated by this JSP.

Add:

```<code>PrintWriter out = new PrintWriter (response.getOutputStream ());
</code>```

ContentLicense: CC BY-SA 4.0

Body:
out object shows error like cannot find symbol. Tried many ways to fix the error. But it stil shows error

<%@ page import="java.sql.*" %>
<%!
    void loadBuilding() throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost/crm", "root", "");
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("select name from building where 1");
        rs.last();
        int count = rs.getRow();
        if (count > 0) {
            rs.beforeFirst();
            while (rs.next()) {
                out.print("");
            }
        } else {
            out.print("No Buildings Added Yet");
        }
    }
%>

<%
    loadBuilding();
%>

Body:
Based on the methods you are calling on out, you might need out to be a PrintWriter whose output is written to the OutputStream of the response generated by this JSP.

Add:

PrintWriter out = new PrintWriter (response.getOutputStream ());


问:
Python IOError: [Errno 2] No such file or directory:
I am just trying to open an image, I know there are several IOError questions on here, but I have not been able to understand the explanations.

The code i typed is here

```<code>from PIL import Image

image = Image.open("Lenna.png")
image.load()
</code>```

The error obtained is as follows:

```<code>Traceback (most recent call last):
  File "C:\Python27\hello world.py", line 4, in <module>
    image = Image.open("Lenna.png")
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1952, in open
    fp = __builtin__.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'Lenna.png'
</code>```

What do I do here?
Thank you.

答:
If you are trying to open image, either you have to specify the complete path of the image like,

```<code>from PIL import Image

im = Image.open('C:/Users/Anish/Desktop/2017PROJECTS/PYTHON_TWITTER/image/camel.png')
im.show()
</code>```

Or you have to copy the image to the specified project directory and call  the image name like,

```<code>im = Image.open('camel.png')
</code>```

Body:
I am just trying to open an image, I know there are several IOError questions on here, but I have not been able to understand the explanations.

The code i typed is here

from PIL import Image

image = Image.open("Lenna.png")
image.load()

The error obtained is as follows:

Traceback (most recent call last):
  File "C:\Python27\hello world.py", line 4, in <module>
    image = Image.open("Lenna.png")
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1952, in open
    fp = __builtin__.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'Lenna.png'

What do I do here?
Thank you.

Body:
If you are trying to open image, either you have to specify the complete path of the image like,

from PIL import Image

im = Image.open('C:/Users/Anish/Desktop/2017PROJECTS/PYTHON_TWITTER/image/camel.png')
im.show()

Or you have to copy the image to the specified project directory and call  the image name like,

im = Image.open('camel.png')


问:
EF Explicitly loading collection within collection
Simple question but from the Entity Framework MSDN examples and other searches I can't see the correct way to do this.

I can explicitly load an EF collection like so:

```<code>db.Entry(project).Collection(p => p.Reports).Load();
</code>```

But if each report has a list of pages within them that need to load, how do I do it? I figured it was something like:

```<code>db.Entry(project.Reports).Collection(r => r.Pages).Load();
</code>```

But this won't work, because 'r' is an ICollection of Reports. What is the correct way to load collections within collections?

答:
You can use this syntax:

```<code>db.Entry(project).Collection(p => p.Reports)
  .Query()
  .Include(r => r.Pages).Load();
</code>```

As per MSDN, Query ...

Returns the query that would be used to load this collection from the database. The returned query can be modified

... which means that also Include can be applied to it.

Body:
Simple question but from the Entity Framework MSDN examples and other searches I can't see the correct way to do this.

I can explicitly load an EF collection like so:

db.Entry(project).Collection(p => p.Reports).Load();

But if each report has a list of pages within them that need to load, how do I do it? I figured it was something like:

db.Entry(project.Reports).Collection(r => r.Pages).Load();

But this won't work, because 'r' is an ICollection of Reports. What is the correct way to load collections within collections?

Body:
You can use this syntax:

db.Entry(project).Collection(p => p.Reports)
  .Query()
  .Include(r => r.Pages).Load();

As per MSDN, Query ...

Returns the query that would be used to load this collection from the database. The returned query can be modified

... which means that also Include can be applied to it.


答:
Let's compile your code and look at the bytecode:

```<code>   // -- Initialization of s1
   5:   ldc             #2; //String abc
   7:   putfield        #3; //Field s1
   // ...

   // -- Initialization of s2
   11:  aconst_null
   12:  putfield        #4; //Field s2
   // ...

   // -- Initialization of s3
   //    create a StringBuilder
   16:  new             #5; //class StringBuilder
   19:  dup
   20:  invokespecial   #6; //Method StringBuilder."<init>"
   // Load s1
   23:  aload_0
   24:  getfield        #3; //Field s1
   // Call StringBuilder.append(String)
   27:  invokevirtual   #7; //Method StringBuilder.append(String)
   30:  aload_0
   // Load s2
   31:  getfield        #4; //Field s2
   // Call StringBuilder.append(String)
   34:  invokevirtual   #7; //Method StringBuilder.append(String)
   // Get content of StringBuilder
   37:  invokevirtual   #8; //Method StringBuilder.toString()
   // Store in s3
   40:  putfield        #9; //Field s3
</code>```

So how does "null" end up in the result? Well, this is described in the documentation of StringBuilder.append(String):

The characters of the String argument are appended, in order, increasing the length of this sequence by the length of the argument. If str is null, then the four characters "null" are appended.

As Jon Skeet points out, this is all in accordance with the Java Language Specification.

Title: why "abc" + null results abcnull

Body:
Let's compile your code and look at the bytecode:

   // -- Initialization of s1
   5:   ldc             #2; //String abc
   7:   putfield        #3; //Field s1
   // ...

   // -- Initialization of s2
   11:  aconst_null
   12:  putfield        #4; //Field s2
   // ...

   // -- Initialization of s3
   //    create a StringBuilder
   16:  new             #5; //class StringBuilder
   19:  dup
   20:  invokespecial   #6; //Method StringBuilder."<init>"
   // Load s1
   23:  aload_0
   24:  getfield        #3; //Field s1
   // Call StringBuilder.append(String)
   27:  invokevirtual   #7; //Method StringBuilder.append(String)
   30:  aload_0
   // Load s2
   31:  getfield        #4; //Field s2
   // Call StringBuilder.append(String)
   34:  invokevirtual   #7; //Method StringBuilder.append(String)
   // Get content of StringBuilder
   37:  invokevirtual   #8; //Method StringBuilder.toString()
   // Store in s3
   40:  putfield        #9; //Field s3

So how does "null" end up in the result? Well, this is described in the documentation of StringBuilder.append(String):

The characters of the String argument are appended, in order, increasing the length of this sequence by the length of the argument. If str is null, then the four characters "null" are appended.

As Jon Skeet points out, this is all in accordance with the Java Language Specification.


问:
Nesting an input inside another input
I always thought that input elements are prohibited of having DOM contents, as stated here (at 'Permitted content') and here (in 'Tips and Notes').

Now I'm working in a project where several different input element types are rendered and altered in javascript (eg plain input text-elements and select). In that altering process, a hidden input is placed inside those elements, holding the current selected value.

So apparently it is possible via jQuery to add an input element into another input element (and using it afterwards):

function doIt() {
  //clear children of parent input
  $('#parentInput').children().remove();

  //create new input and append it to the parent input
  $('<input>').attr({
    type: 'hidden',
    id: 'testInput',
    value: 'Test value inserted into nested test input'
  }).appendTo($('#parentInput'));

  //get value of new nested input and write it to output div
  $('#output').html($('#testInput').val());
}

$('#doIt').on('click', doIt);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" value="Test" id="parentInput">
<button id="doIt">Do it</button>
<div id="output"></div></code>```

or even a div:

function doIt() {
  //clear children of parent input
  $('#parentInput').children().remove();

  //create new input and append it to the parent input
  $('
Test value inserted into nested test div
').appendTo($('#parentInput'));

  //get value of new nested input and write it to output div
  $('#output').html($('#testDiv').html());
}

$('#doIt').on('click', doIt);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" value="Test" id="parentInput">
<button id="doIt">Do it</button>
<div id="output"></div></code>```

My question now is: Why is that possbile via jQuery (and thus via plain javascript, as jQuery is 'just' a wrapper), when input elements are not supposed to have DOM content?

答:
I always thought that input elements are prohibited of having DOM contents, as stated here (at 'Permitted content') and here (in 'Tips and Notes').

You confuse HTML and DOM. HTML is just text. DOM is what the browser creates from that text.

The following is HTML. It's invalid and no browser will create nested nodes from it:

```<code><input type="text" value="Test" id="parentInput">
  <div id="testDiv">Test value inserted into nested test div</div>
</input>
</code>```

The DOM tree that the browser creates will most likely look like it came from this HTML:

```<code><input type="text" value="Test" id="parentInput">
<div id="testDiv">Test value inserted into nested test div</div>
</code>```

The end tag is ignored. Browsers are forgiving when it comes to parsing HTML.

If you directly manipulate the DOM as you did, then there is no reason for the browser to prevent that. When it's time to render the DOM, the browser knows how to render an input. It doesn't really care if the input node has a child node. It's simply ignored.

Title: Nesting an input inside another input

Body:
I always thought that input elements are prohibited of having DOM contents, as stated here (at 'Permitted content') and here (in 'Tips and Notes').

Now I'm working in a project where several different input element types are rendered and altered in javascript (eg plain input text-elements and select). In that altering process, a hidden input is placed inside those elements, holding the current selected value.

So apparently it is possible via jQuery to add an input element into another input element (and using it afterwards):

function doIt() {
  //clear children of parent input
  $('#parentInput').children().remove();

  //create new input and append it to the parent input
  $('<input>').attr({
    type: 'hidden',
    id: 'testInput',
    value: 'Test value inserted into nested test input'
  }).appendTo($('#parentInput'));

  //get value of new nested input and write it to output div
  $('#output').html($('#testInput').val());
}

$('#doIt').on('click', doIt);

<input type="text" value="Test" id="parentInput">
<button id="doIt">Do it</button>

or even a div:

function doIt() {
  //clear children of parent input
  $('#parentInput').children().remove();

  //create new input and append it to the parent input
  $('
Test value inserted into nested test div
').appendTo($('#parentInput'));

  //get value of new nested input and write it to output div
  $('#output').html($('#testDiv').html());
}

$('#doIt').on('click', doIt);

<input type="text" value="Test" id="parentInput">
<button id="doIt">Do it</button>

My question now is: Why is that possbile via jQuery (and thus via plain javascript, as jQuery is 'just' a wrapper), when input elements are not supposed to have DOM content?

Body:
I always thought that input elements are prohibited of having DOM contents, as stated here (at 'Permitted content') and here (in 'Tips and Notes').

You confuse HTML and DOM. HTML is just text. DOM is what the browser creates from that text.

The following is HTML. It's invalid and no browser will create nested nodes from it:

<input type="text" value="Test" id="parentInput">
  <div id="testDiv">Test value inserted into nested test div</div>
</input>

The DOM tree that the browser creates will most likely look like it came from this HTML:

<input type="text" value="Test" id="parentInput">
<div id="testDiv">Test value inserted into nested test div</div>

The end tag is ignored. Browsers are forgiving when it comes to parsing HTML.

If you directly manipulate the DOM as you did, then there is no reason for the browser to prevent that. When it's time to render the DOM, the browser knows how to render an input. It doesn't really care if the input node has a child node. It's simply ignored.


问:
Set 'selected' value in select box dropdown list - based on first letter
I have a zend form that has a select box with 1000+ id->name options sorted alphabetically.
When rendered and looking at it in a browser, if you type Ch it goes all the way to that option;

Is there a way I can set the value to be selected via the first few letters after the form has been initialized? In other words $form->getElement('name')->setSelected('Ch') or similar;

I know that with setValue(34) I can set the name to be selected that has the ID 34.

答:
Just wrote the code myself</p>

```<code>class My_Form_Element_Select extends Zend_Form_Element_Select{
/**
 * Sets the the first option to start with certain letters to be selected
 * @param string $string The first few letters to search for
 */
public function setSelected($string){
    $string = strtolower($string);
    $options = $this->_getMultiOptions();
    $length = strlen($string);
    foreach($options as $value => $option){
        if($string == strtolower(substr($option,0,$length))){
            $this->setValue($value);
            break;
        }
    }
    return $this;
}
</code>```

Body:
Just wrote the code myself

class My_Form_Element_Select extends Zend_Form_Element_Select{
/**
 * Sets the the first option to start with certain letters to be selected
 * @param string $string The first few letters to search for
 */
public function setSelected($string){
    $string = strtolower($string);
    $options = $this->_getMultiOptions();
    $length = strlen($string);
    foreach($options as $value => $option){
        if($string == strtolower(substr($option,0,$length))){
            $this->setValue($value);
            break;
        }
    }
    return $this;
}


问:
storing typedef constructor in class
I am trying to figure out to store a typedef in my class, how would I do that? In the example posted I want to create a class which allows me to initiate a number of objects with different "Fct" parameters, like "one" or "slope", and or even change an object's "Fct f" with a set function:</p>

```<code>typedef double Fct(double);

double one(double x) { return 1; }
double slope(double x) { return x / 2; }

struct myFct : Shape {
    myFct(Fct f)
        :f(f) {}; //"f" is not a nonstatic data member of base class of class "myFct"

private:
    Fct f;
};
</code>```

答:
Your typedef stands for a function type. That very typedef can be used to declare member functions. So your class has a member function f declaration. It accepts a double and returns a double.

I suspect what you want is a function pointer as a member variable. Do it explicitly:

```<code>struct myFct : Shape {
    myFct(Fct *f)
        :f(f) {}; //"f" is not a nonstatic data member of base class of class "myFct"

private:
    Fct *f;
};
</code>```

You may consider yourself lucky, having stumbled on a somewhat obscure feature.

Title: storing typedef constructor in class

Body:
I am trying to figure out to store a typedef in my class, how would I do that? In the example posted I want to create a class which allows me to initiate a number of objects with different "Fct" parameters, like "one" or "slope", and or even change an object's "Fct f" with a set function:

typedef double Fct(double);

double one(double x) { return 1; }
double slope(double x) { return x / 2; }

struct myFct : Shape {
    myFct(Fct f)
        :f(f) {}; //"f" is not a nonstatic data member of base class of class "myFct"

private:
    Fct f;
};

Body:
Your typedef stands for a function type. That very typedef can be used to declare member functions. So your class has a member function f declaration. It accepts a double and returns a double.

I suspect what you want is a function pointer as a member variable. Do it explicitly:

struct myFct : Shape {
    myFct(Fct *f)
        :f(f) {}; //"f" is not a nonstatic data member of base class of class "myFct"

private:
    Fct *f;
};

You may consider yourself lucky, having stumbled on a somewhat obscure feature.


问:
Generating all permutations of elements in a single array
I’ve seen several similar questions about how to generate all possible permutations of elements in an array. But I’m having a very hard time figuring out how to write an algorithm that will output values that are not included in each permutations:

Starting with the following array (with N elements):

```<code>var array = ["apple", "banana", "lemon", "mango"];
</code>```

And getting the following result:

```<code>var result = [
   "apple not banana  not lemon  not mango"
   "apple banana not lemon not mango"
   "apple banana lemon not mango"
   "apple banana lemon mango"
   "banana not apple not lemon not mango"
   ...
];
</code>```

答:
This simplistic approach uses bitmasks, so it will only work for a relatively small number of words.

var array = ["apple", "banana", "lemon", "mango"];

var result = [];
for (var n = 0; n < 1 << array.length; n++) {
 var i, a = [];
 for (i = 0; i < array.length; i++) if ((n & (1 << i)) == 0) a.push(array[i]);
 for (i = 0; i < array.length; i++) if ((n & (1 << i)) != 0) a.push("not " + array[i]);
 result.push(a.join(" "));
}

console.dir(result.join("\n"));```

Body:
I’ve seen several similar questions about how to generate all possible permutations of elements in an array. But I’m having a very hard time figuring out how to write an algorithm that will output values that are not included in each permutations:

Starting with the following array (with N elements):

var array = ["apple", "banana", "lemon", "mango"];

And getting the following result:

var result = [
   "apple not banana  not lemon  not mango"
   "apple banana not lemon not mango"
   "apple banana lemon not mango"
   "apple banana lemon mango"
   "banana not apple not lemon not mango"
   ...
];


问:
Screen Size Adaptation | XCode | Swift | iOS
I have been rejected by apple because they want my app to run at full resolution of the device's screen I am running my app on. For Example, I have developed my app for iPhone but it runs in a corner on an iPad.
So, They want to run it on iPad at full screen resolution as it runs on an iPad. Please help me fix this issue, I am in a fix after hearing this issue, Thanks for any help!</p>

答: If you want the iPad app to be exactly as iPhone app... Just set your app in project settings to support only iPhone, it will then fit on iPad automatically. (All iPhone apps are supported automatically on iPad in special compatibility mode)</p>


问:
How can I read input from a file line by line in java?
Ok, I know this is a really rookie question, but I looked around online a lot and am yet unable to find the answer to my question:

How can I read input from a file line by line in java?

Assume a file input that has integers on each line, like:

```<code>1
2
3
4
5
</code>```

Here's the snippet of code I am trying to work with:

```<code>public static void main(File fromFile) {

  BufferedReader reader = new BufferedReader(new FileReader(fromFile));

  int x, y;

  //initialize
  x = Integer.parseInt(reader.readLine().trim());
  y = Integer.parseInt(reader.readLine().trim());

}
</code>```

Presumably, this would read in the first two lines and store them as integers in x and y.  So going off the example, x=1, y=2.

It is finding a problem with this, and I don't know why.

答:
```<code> public static void main(String[] args) {
        FileInputStream fstream;
        DataInputStream in = null;
        try {
            // Open the file that is the first
            // command line parameter
            fstream = new FileInputStream("textfile.txt");
            // Get the object of DataInputStream
            in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            int x = Integer.parseInt(br.readLine());
            int y = Integer.parseInt(br.readLine());

            //Close the input stream

        } catch (Exception e) {//Catch exception if any
            System.err.println("Error: " + e.getMessage());
        } finally {
            try {
                in.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
</code>```

Body:
Ok, I know this is a really rookie question, but I looked around online a lot and am yet unable to find the answer to my question:

How can I read input from a file line by line in java?

Assume a file input that has integers on each line, like:

1
2
3
4
5

Here's the snippet of code I am trying to work with:

public static void main(File fromFile) {

  BufferedReader reader = new BufferedReader(new FileReader(fromFile));

  int x, y;

  //initialize
  x = Integer.parseInt(reader.readLine().trim());
  y = Integer.parseInt(reader.readLine().trim());

}

Presumably, this would read in the first two lines and store them as integers in x and y.  So going off the example, x=1, y=2.

It is finding a problem with this, and I don't know why.


问:
Bootstrap on very small screen not working
I have created a table in html and I am using bootstrap for my webpage. I have assigned col-md-12 and col-xs-12 class to my table. My table works fine in big screen but the table rows exceed the table on small screen. I am using Mozilla Developer tools for responsive web design and my code fails to give desired output on small screen of Iphone 6s. What should I do ?
The code is as follows :

```<code> <table  class="table table-striped tablesorter col-md-12 col-xs-12" id = "favtable" >

  <thead >
          <tr>
             <th>Heading1 </th>
             <th >Heading2</th>
             <th >Heading3</th>
             <th >Heading4</th>
          </tr>
 </thead>

 <tbody   id = "favtable2">
 </tbody>
</code>```

答:
wrap your table in one div with class name table-responsive

```<code><div class="table-responsive">
    <table class="table table-striped tablesorter" id="favtable">
        <thead>
            <tr>
                <th>Heading1 </th>
                <th>Heading2</th>
                <th>Heading3</th>
                <th>Heading4</th>
            </tr>
        </thead>
        <tbody id="favtable2">
            <tr>
                <td>Heading1 </td>
                <td>Heading2</td>
                <td>Heading3</td>
                <td>Heading4</td>
            </tr>
        </tbody>
    </table>
</div>
</code>```

https://jsfiddle.net/4c83kavu/1/

Body:
I have created a table in html and I am using bootstrap for my webpage. I have assigned col-md-12 and col-xs-12 class to my table. My table works fine in big screen but the table rows exceed the table on small screen. I am using Mozilla Developer tools for responsive web design and my code fails to give desired output on small screen of Iphone 6s. What should I do ?
The code is as follows :

             Heading1
             Heading2
             Heading3
             Heading4

Body:
wrap your table in one div with class name table-responsive

<div class="table-responsive">
    <table class="table table-striped tablesorter" id="favtable">
        <thead>
            <tr>
                <th>Heading1 </th>
                <th>Heading2</th>
                <th>Heading3</th>
                <th>Heading4</th>
            </tr>
        </thead>
        <tbody id="favtable2">
            <tr>
                <td>Heading1 </td>
                <td>Heading2</td>
                <td>Heading3</td>
                <td>Heading4</td>
            </tr>
        </tbody>
    </table>
</div>

https://jsfiddle.net/4c83kavu/1/


问:
FlatXmlDataSet empty table (DBUnit)
Is it possible to validate that the database has no rows for a specific table with a flat xml structure?
Something like:

```<code><dataset>
   <TABLE/>
</dataset
</code>```

but that isn't working because, I think, it only validates if the 'TABLE' exists..

I'm testing a delete..

答:
Currently, I have the same issue and I found the workaround.
You can set all fields non-Required and your .xml file will be looking like

```<code><?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataset SYSTEM "dbschema.dtd">
<dataset>
    <NameOfYourTable/>
</dataset>
</code>```

I hope it will help other people.

Title: FlatXmlDataSet empty table (DBUnit)

Body:
Is it possible to validate that the database has no rows for a specific table with a flat xml structure?
Something like:

<dataset>

</dataset

but that isn't working because, I think, it only validates if the 'TABLE' exists..

I'm testing a delete..

Body:
Currently, I have the same issue and I found the workaround.
You can set all fields non-Required and your .xml file will be looking like

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataset SYSTEM "dbschema.dtd">
<dataset>
    <NameOfYourTable/>
</dataset>

I hope it will help other people.