.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? - gwt

I am new to Gwt i am trying to create a web application and invoke it using an maven plugin. But the problem is during invocation of code server i am getting an error like unable to find xxxx..gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? I have tried to add the .gwt.xml file into class path in serveral ways like include additional classpath etc.., but nothing helps... is there is any way to add it to the maven class path.

It seems that the gwt-maven-plugin is not able to find the configured module.
Please see the configuration of this plugin in the pom.xml, i.e. the section:
<modules>
<!-- this refers to xxxx..gwt.xml -->
<module>xxxx</module>
</modules>
If you cant resolve the problem you could compare your project with a minimal working "Hello-World-GWT-Project".
You could create such a template-project with a maven archetype:
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.7.0

Related

Disable modules in owasp dependency-check maven plugin

In my project I use dependency-check-maven to run OWASP verifications. Project contains several java modules and a front end module. Configuration in pom is basic one like this
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>5.3.2</version>
<configuration>
<failBuildOnCVSS>4</failBuildOnCVSS>
<suppressionFiles>
<suppressionFile>owasp-suppressions.xml</suppressionFile>
</suppressionFiles>
<cveUrlBase>...</cveUrlBase>
<cveUrlModified>...</cveUrlModified>
<format>ALL</format>
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
<cveValidForHours>24</cveValidForHours>
</configuration>
</plugin>
Is it possible to configure the plugin such way that it ignores my front end module but analyses all other ones?
I try to run mvn -Dowasp.dependency-check.excludes=frontend-1.0.1-SNAPSHOT.jar org.owasp:dependency-check-maven:aggregate in the root folder of my project but verification is done in frontend as well
I've the same issue to ignore some javascript modules to be analyzed by the dependency check.
As you can see at https://github.com/jeremylong/DependencyCheck/issues/1009 the developers have an open PR to resolve this request.
I've solved this by not building the javascript module:
mvn verify -pl '!frontend'
It's just a workaround to get the results of the dependency-check locally.
Maybe there exists better ideas?

The import org.apache.commons cannot be resolved in eclipse juno

I am having a problem while compiling my project in Eclipse. It is showing the error The import org.apache.commons cannot be resolved.
Please tell me what does this error means and how to solve it.
The mentioned package/classes are not present in the compiletime classpath. Basically, Java has no idea what you're talking about when you say to import this and that. It can't find them in the classpath.
It's part of Apache Commons FileUpload. Just download the JAR and drop it in /WEB-INF/lib folder of the webapp project and this error should disappear. Don't forget to do the same for Apache Commons IO, that's where FileUpload depends on, otherwise you will get the same problem during runtime.
Unrelated to the concrete problem, I see that you're using Tomcat 7, which is a Servlet 3.0 compatible container. Do you know that you can just use the new request.getPart() method to obtain the uploaded file without the need for the whole Commons FileUpload stuff? Just add #MultipartConfig annotation to the servlet class so that you can use it. See also How to upload files to server using JSP/Servlet?
If you got a Apache Maven project, it's easy to use this package in your project. Just specify it in your pom.xml:
<project>
...
<properties>
<version.commons-io>2.4</version.commons-io>
</properties>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${version.commons-io}</version>
</dependency>
</dependencies>
...
</project>
expand "Java Resources" and then 'Libraries' (in eclipse project).
make sure that "Apache Tomcat" present.
if not follow-
right click on project -> "Build Path" -> "Java Build Path" -> "Add Library" -> select "Server Runtime" -> next -> select "Apache Tomcat -> click finish
You could just add one needed external jar file to the project.
Go to your project-->java build path-->libraries, add external JARS.Then add your downloaded file from the formal website. My default name is commons-codec-1.10.jar
Look for "poi-3.17.jar"!!!
Download from "https://poi.apache.org/download.html".
Click the one Binary Distribution -> poi-bin-3.17-20170915.tar.gz
Unzip the file download and look for this "poi-3.17.jar".
Problem solved and errors disappeared.
You could also add the external jar file to the project.
Go to your project-->properties-->java build path-->libraries, add external JARS. Then add your downloaded jar file.
In my little experience, I have solved the issue about org.apache.commons.cli, on my Eclipse Version: 2019-12 (4.14.0):
In Provar(2.8.0), Issue got resolved after adding the jar file(commons-io-2.11.0.jar) to the project.
Steps:
1.Download the latest JAR file from https://commons.apache.org/proper/commons-io/download_io.cgi
Added jar file under lib folder in project.
2.Project--> Properties --> Java build path --> Libraries--Add Jars from lib folder.

Include jar files from maven repository to eclipse project?

How can I include jars from local maven repository into eclipse project? Actually, I need to include them into WebContent/WEB-INF/lib directory in eclipse web service project, if it makes any differencies.
Open your pom file and add a dependency like this.. suppose the jar you want to add from local repository is myfaces-10.jar
and if it is in the path .m2\repository\org\apache\myfaces\myfaces\10\myfaces-10.jar .. then add a dependency in your pom.xml like this..
<dependencies>
.
.
<dependency>
<groupId>org.apache.myfaces</groupId>
<artifactId>myfaces</artifactId>
<version>10</version>
</dependency>
.
.
now the jar will be available in the classpath and you can use it in your project..
make sure your groupId matches the path like in my example...
hope it helps..

Eclipse Maven Dependency

I have just added dependencies to an eclipse project so that my jar can see other jars. How can I be sure that the dependencies work, and that what I've done is correct? I view a pom.xml file that has been created so what are the target folder and classes,test-classes subfolders used for? Thanks
If you have the m2eclipse plugin installed you can open your pom in Eclipse and click on the Dependency Hierarchy tab to view your resolved dependencies. You should manage all dependencies through Maven with the setup you are describing.
If you want to check command line you may want to look at using Effective Pom.
If you use m2e, it adds Maven Dependencies pseudo library to your project.
You may expand it and see if the dependent jar file is in there.
If it is, Eclipse ( or more precisely m2e ) has resolved the dependency correctly and it's available for you project build.
If you added your dependencies correctly your application should build and execute correctly, or am I missing something? Dependencies should be added to a POM section that looks like this example:
<dependencies>
<dependency>
<groupId>annogen</groupId>
<artifactId>annogen</artifactId>
<version>0.1.0</version>
</dependency>
<!-- other dependencies here -->
</dependencies>
Maven and the m2e/m2eclipse plugin rely on source files to be conventionally placed in src/main/java for application code and src/test/java for test code. Application code is compiled to target/classes and test code is compiled to target/test-classes. If you plan to use Maven and/or m2e/m2eclipse, do read about it. Maven: The Complete Reference is a good starting point.

Adding dependencies in Maven Netbeans

I've created a Maven project and added the dependencies (jar files) that I need; however, netbeans says that it still cannot find it.
Specifically in my case, I added the jmf-2.1.1e.jar file into my dependencies folder. When I go back to my program it still gives me the compile error that it cannot find the javax.media package.
Did you let Netbeans manage the dependency?
In your "Projects" listing, find and context+click on the "Dependencies" folder in the list. From the context menu, choose "Add Dependency".
This approach works at least in NetBeans 7.4 and 8.0 beta.
Make sure that your pom.xml has the following snippet that defines the dependency
<dependencies>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jmf</artifactId>
<version>2.1.1e</version>
</dependency>
</dependencies>
The dependency is available in Maven Central. Add the pom snippet manually to the pom.xml and run Maven in the shell and let it download the dependency. This should resolve your issue.
Maven automatically downloads the dependency once specified in the pom.xml. For this you would have to build your project with the dependency as specified by Tim Sparg.