I want to use wagon-maven-plugin with download-single goal from a correct url but maven says:
Error handling resource: Resource missing at http://myurl/from/file%3FWSDL 404 Not Found -> [Help 1]
Here is the plugin definition:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>fetch-wsdl</id>
<phase>initialize</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>http://myurl</url>
<fromFile>from/file?WSDL</fromFile>
<toFile>${project.basedir}/src/main/resources/wsdl/Consumer.wsdl</toFile>
</configuration>
</execution>
</executions>
</plugin>
The problem here is I have a query symbol in my url but wagon-maven-plugin replace it by %3F.
for example: It converts http://myurl/from/file?WSDL to http://myurl/from/file%3FWSDL
Are there anyone who face this issue as well?
Note: If I use with another url without query symbol it works.
Well, It is a known issue that it does not work with query symbol. I am going to use another plugin maven-download-plugin.
Related
I have the following error when trying to generate classes from my wsdl:
Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate (CreateWebServiceAccountV1) on project hblws.test: Execution CreateWebServiceAccountV1 of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: can't parse argument number: ''http://java.sun.com/xml/ns/jaxb'': For input string: "''http://java.sun.com/xml/ns/jaxb''" -> [Help 1]
I have one wsdl file and multiple XSD/XJB. XJB have following namespace : xmlns="http://java.sun.com/xml/ns/jaxb"
Here is the code of pom.xml that execute the JAXB/XJC generation :
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<!-- CreateWebServiceAccount V1 -->
<execution>
<id>CreateWebServiceAccountV1</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<sourceDestDir>
${project.build.directory}/generated-sources
</sourceDestDir>
<wsdlFiles>
<wsdlFile>CreateWebServiceAccountV1.wsdl</wsdlFile>
</wsdlFiles>
<wsdlDirectory>${basedir}/src/main/webapp/WEB-INF/wsdl/</wsdlDirectory>
<verbose>true</verbose>
<bindingFiles>
<bindingFile>${basedir}/src/main/webapp/META-INF/wsdl/CreateWebServiceAccountV1.xjb</bindingFile>
<bindingFile>${basedir}/src/main/webapp/META-INF/wsdl/CreateWebServiceAccountV1Model.xjb</bindingFile>
<bindingFile>${basedir}/src/main/webapp/META-INF/wsdl/SystemFault-v1.xjb</bindingFile>
</bindingFiles>
<staleFile>${project.build.directory}/jaxws/stale/wsdl.CreateWebServiceAccountV1.done</staleFile>
<schemaDirectory>${basedir}/src/main/webapp/META-INF/wsdl/</schemaDirectory>
</configuration>
</execution>
</executions>
</plugin>
Thanks in advance for your help !
This is a bug of JDK,see JDK-8204933.
Solution, change locale to en, the others will fail:
<configuration>
<locale>en</locale>
<configuration>
The English (and portuguese) version correctly quote
, all other localizations replace this with the faulty
For me, this plugin tell me the true cause:
org.xml.sax.SAXParseException: not an external binding file. The root element must be {http://java.sun.com/xml/ns/jaxb}bindings but it is {https://java.sun.com/xml/ns/jaxb}bindings
I have been looking around a lot regarding this issue. I found some suggestions, but I cannot make them work, so maybe I'm doing something wrong.
Problem
I have inter-depending XSDs in the same maven project. I have commonA.xsd & commonB.xsd which have generic types and I have a specific.xsd which references those two. The problem is that I cannot make the hierarchical generation work.
My current pom.xml
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<id>base</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>commonA.xsd</include>
<include>commonB.xsd</include>
</schemaIncludes>
<generatePackage>common</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc-common</generateDirectory>
</configuration>
</execution>
<execution>
<id>specific</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaIncludes>
<include>specific.xsd</include>
</schemaIncludes>
<generatePackage>specific</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/xjc-specific</generateDirectory>
</configuration>
</execution>
</executions>
</plugin>
Attempted solutions
Referencing the episode file
I found this page https://stackoverflow.com/a/11135186/284263 where it is proposed to reference the episode file.
[ERROR] Error while parsing schema(s).Location [ file:/path/to/xsd/COMMONA.XSD{122,60}].com.sun.istack.SAXParseException2; systemId: file:/path/to/xsd/COMMONA.XSD; lineNumber: 122; columnNumber: 60; (the above customization is attached to the following location in the schema)
This didn't work for me and it also feels a bit hacky.
Create a bindings.xjb
I also looked into this answer https://stackoverflow.com/a/22559100/284263. I cannot find any 'real' examples anywhere, and I don't know if this is the correct approach anyway for my case.
Referring to maven artifact
I found in the plugin's documentation that I can do something like this:
<episodes>
<episode>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-tests-po</artifactId>
<!-- Version of the artifact. May be omitted.
The plugin will then try to find the version using
the dependencyManagement and dependencies of the project. -->
<version>${project.version}</version>
</episode>
</episodes>
This is an external reference, as far as I understand. It doesn't work, because the artifact doesn't exist in the repo yet, e.g. when developing and having a SNAPSHOT version, or might be risky because it will refer an older version.
Any suggestions or corrections?
Thanks for your time.
I am trying to overwrite the following property in maven using gmaven:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>setproperty</id>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
pom.properties['main.build.directory']=project.parent.build.directory.absolutePath.replace('\\','/');
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
But I get this error:;
[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (setproperty) on project my-project: startup failed, script139276
2592853.groovy: 1: expecting ''', found '<EOF>' # line 1, column 84.
[ERROR] 1 error
What is wrong with the above groovy snippet?
Value of a property which is set using gmavenplus-plugin displays correctly when accessed using the plugin. It will display correctly even if it is accessed using different instances of the same plugin.
Problem arises when value of a property which is already initialized outside the plugin is altered by the plugin and it is accessed outside the plugin. Now the value of the property is not the value as updated by plugin. The updated value is now scoped within the plugin. As a workaround to solve this issue if a property has to be updated by the plugin and is required to be accessed outside the scope of plugin: do not declare or initialize it, in case it needs to be then declare and initialize the property through the plugin.
I agree with #khmarbaise that this is a little weird to do, but if you must...I'm not sure offhand why it isn't working. That plugin isn't really maintained anymore. <shamelessPlug>I think this should work:
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>setproperty</id>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scripts>
<script><![CDATA[project.properties['main.build.directory']=project.parent.build.directory.replace('\\','/')]]></script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>
For more info on this mojo, check out http://groovy.github.io/GMavenPlus/execute-mojo.html.
</shamelessPlug>. However, be aware that I believe this will be scoped within the plugin.
What is the format for specifying a package in the Antlr4 maven plugin antlr4-maven-plugin?
I feel like I should be able to do the following:
<plugin>
<groupId>com.tunnelvisionlabs</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<arguments>package my.package.name</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
but that results in the following error:
[ERROR] Failed to execute goal com.tunnelvisionlabs:antlr4-maven-plugin:4.0:antlr4 (default) on project my_project: Unable to parse configuration of mojo com.tunnelvisionlabs:antlr4-maven-plugin:4.0:antlr4 for parameter arguments: Cannot assign configuration entry 'arguments' with value 'package my.package.name' of type java.lang.String to property of type java.util.List -> [Help 1]
If I am you, I will make a maven project per package and try this
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<sourceDirectory>${basedir}/src</sourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
but usually, When I pass an argument in maven configuration, I do the following. but I am not sure of that syntax in antlr4
<plugin>
<groupId>com.tunnelvisionlabs</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.0</version>
<configuration>
<arguments>
<argument>-package</argument>
<argument>my.package.name</argument>
</arguments>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
Edit: Notice the - in front of package so the antlr-maven-plugin will recognize it as a parameter
The package is automatically determined based on the location of the file in your project, similar to the way the package is determined for Java files. The output is also placed in a location determined by the location of the source file. To change the package where the code is generated, you'll need to move the grammar file.
Other arguments can be specified like this:
<arguments>
<argument>arg1</argument>
<argument>arg2</argument>
</arguments>
Your configuration arguments syntax is wrong.
Please change the configuration of antlr4-maven-plugin from
<configuration>
<arguments>package my.package.name</arguments>
</configuration>
to:
<configuration>
<arguments>
<argument>-package</argument>
<argument>my.package.name</argument>
</arguments>
</configuration>
In order to add package information to the generated code you must add the following annotation to the g4 file:
#header {
package com.this.is.my.package;
}
I tried
#header {
package com.this.is.my.package;
}
but when you have imports it adds package line for each file imported and as a result compiler errors raised in generated file. You have to be careful to add #header so file with imported grammars had only one package line. I think it's a bug.
I have the Demo.g4 inside src/main/antlr4/de/schmitz.
Now the classes are generated to target/generated-sources/antlr4/de/schmitz.
The package is de.schmitz.
Everything is correct.
Now I want to change the package and folders of the generated classes (actually NOT moving my Demo.g4):
<arguments>
<argument>-package</argument>
<argument>my.package</argument>
</arguments>
The classes are generated to target/generated-sources/antlr4/de/schmitz.
The package is my.package.
This cannot be compiled, so it could be an error.
So I want to change the output directory:
<outputDirectory>${project.build.directory}/generated-sources/antlr4/my/package</outputDirectory>
Now it get's buggy.
The package is my.package.
But the folder is target/generated-sources/antlr4/my/package/de/schmitz.
So it's concatenated instead of overwritten.
This is part of my pom.xml of my .ear file
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wls-maven-plugin</artifactId>
<version>12.1.1.0</version>
<configuration>
<adminurl>${adminURL}</adminurl>
<user>${username}</user>
<password>${pswrd}</password>
<upload>true</upload>
<remote>false</remote>
<verbose>true</verbose>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<name>${project.build.finalName}</name>
<targets>${serverName}</targets>
<noExit>true</noExit>
<middlewareHome>${middlewareH}</middlewareHome>
<domainHome>${domainH}</domainHome>
</configuration>
<executions>
<execution>
<id>stopserver</id>
<phase>install</phase>
<goals>
<goal>stop-server</goal>
</goals>
<configuration>
<action>stopserver</action>
<workingDir>${stopScriptDirectory}</workingDir>
<command>stopScript.sh</command>
</configuration>
</execution>
</executions>
</plugin>
I am trying to stop the server by running the stopScript.sh
This is the error I am getting when it is trying to execute the stop-server goal:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.weblogic:wls-maven-plugin:12.1.1.0:stop-server (stopserver) on project OventusEAR2: Unable to parse configuration of mojo com.oracle.weblogic:wls-maven-plugin:12.1.1.0:stop-server for parameter command: Cannot assign configuration entry 'command' with value 'stopScript.sh' of type java.lang.String to property of type java.lang.String[]
Any ideas?
Though I am not familiar with this particular plugin, however I have seen similar issues before, I guess command parameter is expecting an array instead.
Please try replacing
<command>stopScript.sh</command>
with
<command>
<value>stopScript.sh</value>
</command>
and test again.