Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install maven plugin #2

Open
thakurshishir opened this issue Jan 17, 2018 · 6 comments
Open

Unable to install maven plugin #2

thakurshishir opened this issue Jan 17, 2018 · 6 comments
Labels

Comments

@thakurshishir
Copy link

thakurshishir commented Jan 17, 2018

Hi,
I have added the following plugin into pom.xml:

<plugin>
  <groupId>org.walkmod.maven.plugins</groupId>
   <artifactId>walkmod-maven-plugin</artifactId>
   <version>1.0.3</version>
   <executions>
      <execution>
         <phase>generate-sources</phase>
         <goals>
            <goal>apply</goal>
         </goals>
      </execution>
   </executions>
</plugin>

When I run this with maven plugin it gives the following error:

FATAL [main] - The markup declarations contained or pointed to by the document type declaration must be well-formed. at (-//WALKMOD//DTD:1:3)
org.xml.sax.SAXParseExceptionpublicId: -//WALKMOD//DTD; systemId: http://cso.att.com/FAQs/URLFiltering/ProxyWarning.html; lineNumber: 1; columnNumber: 3; The markup declarations contained or pointed to by the document type declaration must be well-formed.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1437)
        at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:2020)
        at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:305)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1180)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
        at org.walkmod.util.DomHelper.parse(DomHelper.java:90)
        at org.walkmod.conf.providers.XMLConfigurationProvider.loadDocument(XMLConfigurationProvider.java:214)
        at org.walkmod.conf.providers.XMLConfigurationProvider.init(XMLConfigurationProvider.java:143)
        at org.walkmod.conf.ConfigurationManager.executeConfigurationProviders(ConfigurationManager.java:123)
        at org.walkmod.conf.ConfigurationManager.addProviders(ConfigurationManager.java:61)
        at org.walkmod.conf.ConfigurationManager.<init>(ConfigurationManager.java:75)
        at org.walkmod.conf.ConfigurationManager.<init>(ConfigurationManager.java:79)
        at org.walkmod.WalkModFacade.install(WalkModFacade.java:567)
        at org.walkmod.commands.InstallCommand.execute(InstallCommand.java:46)
        at org.walkmod.WalkModDispatcher.execute(WalkModDispatcher.java:172)
        at org.walkmod.WalkModDispatcher.main(WalkModDispatcher.java:197)

Can you help resolving this issue?

@rpau
Copy link
Collaborator

rpau commented Jan 17, 2018

Please, could you use the markdown language of GitHub?

Otherwise it becomes really hard. I would need the contents of your pom.xml file. Have you created any walkmod.xml file manually?

@rpau
Copy link
Collaborator

rpau commented Jan 17, 2018

@thakurshishir I have updated your comment with markdown. Now it seems more clear. It seems that you have created a walkmod.xml file. Could you share the contents please?

@thakurshishir
Copy link
Author

thakurshishir commented Jan 18, 2018

At first I tried without creating walkmod.xml, but the same error was thrown during maven build.

So, I created walkmod.xml into the project repository with different formats:

<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.0.dtd">
<walkmod>
<plugins>
	<plugin groupId="org.walkmod" artifactId="walkmod-imports-cleaner-plugin" version="2.0"/>
</plugins>
<chain name="example-chain">
<transformation type="walkmod:commons:import-cleaner"/>
</chain>
</walkmod>
<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD"  "http://www.walkmod.com/dtd/walkmod-1.0.dtd" >
<walkmod>
	<plugins>
		<plugin groupId="org.walkmod" artifactId="walkmod-imports-cleaner-plugin"
			version="2.0" />
	</plugins>
	<chain name="example-chain">
		<reader path="src/" />
		<transformation type="walkmod:commons:import-cleaner" />
	</chain>
</walkmod>
<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD"  "http://www.walkmod.com/dtd/walkmod-1.0.dtd" > 
 <walkmod> 
	<plugins> 
 		<plugin groupId="org.walkmod" artifactId="walkmod-imports-cleaner-plugin" 
 			version="2.0" /> 
 		<plugin groupId="org.walkmod" artifactId="walkmod-license-applier-plugin" 
 			version="2.0" /> 
 		<plugin groupId="org.walkmod" artifactId="walkmod-setter-getter-plugin" 
 			version="2.0" /> 
 	</plugins>
 	<chain name="common"> 
 		<transformation type="walkmod:commons:import-cleaner" /> 
 		<transformation type="walkmod:commons:license-generator"> 
 			<param name="licenseFile">src/main/license-header.txt</param> 
 		</transformation> 
 	</chain> 
</walkmod>

@rpau
Copy link
Collaborator

rpau commented Mar 4, 2018

Remove the walkmod.xml file and use this command:

walkmod apply imports-cleaner

Alternatively, you can create a walkmod.xml file with these contents:

<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.1.dtd">
<walkmod>
<transformation type="imports-cleaner"/>
</walkmod>

If it does not work, probably is because you are using a proxy server.

@thakurshishir
Copy link
Author

thakurshishir commented Mar 5, 2018

Thanks for the update on the issue.
We were using remote desktop where this is not working. So, now I have switched to my local machine where walkmod apply imports-cleaner is working.
But I am encountering another issue for this.
For some files code transformation is working where the unused imports are removed. But for some files it is giving below error:

Error visiting a Java source file - org.walkmod.util.location.LocationImpl@1998bf4
        at org.walkmod.javalang.walkers.DefaultJavaWalker.visit(DefaultJavaWalker.java:505)
        at org.walkmod.javalang.walkers.DefaultJavaWalker.visit(DefaultJavaWalker.java:250)
        at org.walkmod.javalang.walkers.DefaultJavaWalker.accept(DefaultJavaWalker.java:91)
        at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.walkmod.walkers.AbstractWalker.walk(AbstractWalker.java:264)
        at org.walkmod.walkers.AbstractWalker.execute(AbstractWalker.java:279)
        at org.walkmod.javalang.walkers.DefaultJavaWalker.execute(DefaultJavaWalker.java:173)
        at org.walkmod.impl.DefaultChainWalkerInvocation.invoke(DefaultChainWalkerInvocation.java:41)
        at org.walkmod.impl.DefaultChainInvocation.invoke(DefaultChainInvocation.java:38)
        at org.walkmod.impl.DefaultChainAdapter.execute(DefaultChainAdapter.java:166)
        at org.walkmod.conf.entities.impl.ConfigurationImpl.executeAllChains(ConfigurationImpl.java:607)
        at org.walkmod.conf.entities.impl.ConfigurationImpl.execute(ConfigurationImpl.java:822)
        at org.walkmod.WalkModFacade.run(WalkModFacade.java:284)
        at org.walkmod.WalkModFacade.apply(WalkModFacade.java:142)
        at org.walkmod.commands.ApplyCommand.execute(ApplyCommand.java:40)
        at org.walkmod.WalkModDispatcher.execute(WalkModDispatcher.java:172)
        at org.walkmod.WalkModDispatcher.main(WalkModDispatcher.java:197)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.walkmod.walkers.AbstractWalker.visit(AbstractWalker.java:123)
        at org.walkmod.walkers.AbstractWalker.visit(AbstractWalker.java:171)
        at org.walkmod.javalang.walkers.DefaultJavaWalker.visit(DefaultJavaWalker.java:497)
        ... 18 more
Caused by: java.lang.ClassCastException: org.walkmod.javalang.TokenMgrError cannot be cast to org.walkmod.javalang.ParseException
        at org.walkmod.javalang.ASTManager.parse(ASTManager.java:276)
        at org.walkmod.javalang.ASTManager.parse(ASTManager.java:202)
        at org.walkmod.commentscleaner.visitors.CommentsCleanerVisitor.requiresToDelete(CommentsCleanerVisitor.java:100)
        at org.walkmod.commentscleaner.visitors.CommentsCleanerVisitor.requiresToDelete(CommentsCleanerVisitor.java:92)
        at org.walkmod.commentscleaner.visitors.CommentsCleanerVisitor.visit(CommentsCleanerVisitor.java:55)
        ... 24 more

@rpau rpau added the bug label Mar 14, 2018
@rpau
Copy link
Collaborator

rpau commented Mar 14, 2018

Ok, thanks for the stacktrace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants