I learning Spring development and trying to configure the Spring framework step by step following a project on Github (the website is: https://github.com/spring-projects/spring-framework/wiki/Building-a-distribution-with-dependencies). After typing in the command $ ./gradlew depsZip to Run the depsZip gradle task . the following information was shown with a failure:
:spring-aspects:compileJava
Download http://repo.springsource.org/libs-release/org/aspectj/aspectjrt/1.7.1/a
spectjrt-1.7.1.jar
[ant:iajc] C:\Users\Zihan\Documents\GitHub\spring-framework\spring-aspects\src\m
ain\java\org\springframework\beans\factory\aspectj\AbstractBeanConfigurerAspect.
aj:1 [error] The type java.lang.CharSequence cannot be resolved. It is indirectl
y referenced from required .class files
[ant:iajc] (no source information available)
[ant:iajc] C:\Users\Zihan\Documents\GitHub\spring-framework\spring-aspects\src\m
ain\java\org\springframework\mock\staticmock\AbstractMethodMockingControl.aj:19
[error] The import java.util.Arrays cannot be resolved
[ant:iajc] import java.util.Arrays;
[ant:iajc] ^^^^^^^^^^^^^^^
[ant:iajc] C:\Users\Zihan\Documents\GitHub\spring-framework\spring-aspects\src\m
ain\java\org\springframework\mock\staticmock\AbstractMethodMockingControl.aj:87
[error] Arrays cannot be resolved
[ant:iajc] if (!Arrays.equals(this.args, args)) {
[ant:iajc] ^
[ant:iajc]
[ant:iajc] 3 errors
:spring-aspects:compileJava FAILED
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Zihan\Documents\GitHub\spring-framework\spring-aspects\aspects.
gradle' line: 30
* What went wrong:
Execution failed for task ':spring-aspects:compileJava'.
> compile errors: 3
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 42.798 secs
C:\Users\Zihan\Documents\GitHub\spring-framework [(abdcefb...)]>
could any help me with the configuration problem. really appreciate if giving some guidance.
Thanks in advance!
Firstly, why you can't use a dependency managment tool like maven or gradle? At your link I read
Although it is strongly recommended that Spring Framework users take advantage of the transitive dependency management features of build systems like Gradle, Maven, and Ivy, some teams cannot use these tools. This is usually due to corporate restrictions or working with legacy builds
Using tool defined above simply the build and the mantainence to a spring project. Then to start with a spring project you can following this Building Spring Project
Related
Looking to run the simplest possible example using saxon, and, specifically, Saxon-HE:
thufir#dur:~/NetBeansProjects/helloWorldSaxon$
thufir#dur:~/NetBeansProjects/helloWorldSaxon$ gradle clean run
> Task :compileJava FAILED
/home/thufir/NetBeansProjects/helloWorldSaxon/src/main/java/helloWorldSaxon/App.java:6: error: package com.saxonica.xqj does not exist
import com.saxonica.xqj.SaxonXQDataSource;
^
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
2 actionable tasks: 2 executed
thufir#dur:~/NetBeansProjects/helloWorldSaxon$
I don't think that's the right import statement, but neither am I sure what would be correct. A closer look at the sample reveals that it's using saxonica and has actually commented out the import:
//import net.sf.saxon.xqj.SaxonXQDataSource;
To re-iterate, would want to stay within Saxon-HE. But how?
From the build file:
compile (group = "net.sf.saxon" , name = "Saxon-HE" , version = "9.9.0-2")
Sticking to Saxon-HE this is the correct import?
Which data source does this ship with?
thufir#dur:~/saxon$
thufir#dur:~/saxon$ jar tf Saxon-HE.jar | grep data
net/sf/saxon/data/
net/sf/saxon/data/analyze-string.xsd
net/sf/saxon/data/casevariants.xml
net/sf/saxon/data/categories.xml
net/sf/saxon/data/chameleon.xsl
net/sf/saxon/data/json.xsd
net/sf/saxon/data/normalizationData.xml
net/sf/saxon/data/override.xsl
net/sf/saxon/data/unicodeBlocks.xml
net/sf/saxon/data/xml-to-json-indent.xsl
net/sf/saxon/data/xml-to-json-pkg.xsl
net/sf/saxon/data/xml-to-json.xsl
net/sf/saxon/data/xpath-functions.scm
net/sf/saxon/data/xpath-functions.xsd
net/sf/saxon/resource/MetadataResource$1.class
net/sf/saxon/resource/MetadataResource.class
thufir#dur:~/saxon$
Do I need more compile dependencies? If so, which ones?
The class SaxonXQDataSource is in package com.saxonica.xqj. If you are using Saxon-HE, then you will need to have the JAR file saxon9-xqj.jar on the classpath.
The reason Saxon's XQJ library is treated differently from the rest of Saxon-HE is that the licensing is different. The XQJ interface is published by Oracle, and Oracle claim that implementations are subject to the Oracle licensing conditions (some people dispute that implementing a published API requires a license, but that's a matter for the lawyers). The Oracle licensing conditions don't conform to the accepted standards for open source licensing (for two reasons: (a) they disallow modifications, and (b) they require implementations to pass all the reference tests). For this reason some software companies who redistribute Saxon-HE prefer to exclude XQJ from the distribution, and to make this easy, we put the XQJ classes in a separate JAR file.
Following the Quickstart of the ReadMe file of Hibernate library,
I came across the following problem when trying to run this piece of code:
./gradlew clean build
org.hibernate.test.type.TimeAndTimestampTest > test FAILED
java.lang.AssertionError at TimeAndTimestampTest.java:47
org.hibernate.test.timestamp.JdbcTimeDefaultTimeZoneTest > testTimeZone FAILED
java.lang.AssertionError at JdbcTimeDefaultTimeZoneTest.java:83
5335 tests completed, 2 failed, 209 skipped
:hibernate-core:test FAILED
:hibernate-core:buildDashboard
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':hibernate-core:test'.
A build operation failed.
Could not write XML test results for org.hibernate.test.annotations.derivedidentities.e3.b3.DerivedIdentityEmbeddedIdParentEmbeddedIdGrandparentEmbeddedIdColumnOverridesDepTest to file /home/liver/Documents/repos/hibernate-orm/hibernate-core/target/test-results/TEST-org.hibernate.test.annotations.derivedidentities.e3.b3.DerivedIdentityEmbeddedIdParentEmbeddedIdGrandparentEmbeddedIdColumnOverridesDepTest.xml.
To build the project I used this workaround:
./gradlew build -x test
However, this isn't appropiate since it skips all the tests while building.
When I try to run that specific test TimeAndTimestampTest.java on IntelliJ I get the following:
Screenshot of the failed test
Apparently,the source code doesn't recognize the following route to import the missing libraries:
org.hibernate.jpamodelgen.xml.jaxb.*
How can I solve this problem?
I'm getting a dependency issue with a jar I'm attempting to use.
I receive the following error
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sparq: Compilation failure: Compilation failure:
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,8] error: cannot find symbol
remote: [ERROR] class ServerQuery
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,34] error: cannot find symbol
Here is the offending java file.
package helpers;
import com.github.koraktor.steamcondenser.*;
public class ServerQuery {
public static String getPlayers() {
SourceServer server = new SourceServer("66.150.155.152",27015);
server.initialize();
return server.toString();
}
}
I've added the following dependency to my pom.xml
<dependency>
<groupId>com.github.koraktor</groupId>
<artifactId>steam-condenser</artifactId>
<version>1.3.9</version>
</dependency>
I've also added the following action_hook pre_build script
mvn install:install-file -Dfile=./app-root/repo/steam-condenser.jar -DgroupId=com.github.koraktor -DartifactId=steam-condenser -Dversion=1.3.9 -Dpackaging=jar
Here's the GitHub for the project
https://github.com/koraktor/steam-condenser-java
And the website for it
http://koraktor.de/steam-condenser/usage/
Any ideas? Completely lost. Help much appreciated.
Since you are including the jar file in your project already, trying to manage the dependency with Maven seems like overkill. You should be able to put the jar file in your project's lib directory like this article describes. Then you won't need to configure that dependency in Maven at all.
I would use Maven for any dependencies that you want to download at the time your application is being built. Any jar files that you are checking into your project shouldn't need to be configured in Maven.
Just by looking at the question and the excerpts provided, I believe you are struggling with the basics of Maven. If I understand the situation correctly you have a library (which is not written by you):
once added to your project as a Maven dependency. This seems reasonable if you want to use it.
once the source code of the library incorrectly added to your own Java project.
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
Based on the errormessage above it seems you have copied one of the sourcefiles from the library into your project. This is now causing problems. The main one is that without your source-folder (src/main/java) correctly representing the package structure declared in the source file (com.github...) it cannot be compiled. Hence the errormessage:
package com.github.koraktor.steamcondenser does not exist.
First of all you need to remove this copy-pasted file entirely an just use the dependency-management feature of Maven to get the library on classpath. After that just follow the examples given by the author of the library using the link you have already found (http://koraktor.de/steam-condenser/usage/).
When I (try to) start Play, I see this:
[info] Loading global plugins from /home/paul/.sbt/plugins
[info] Loading project definition from /home/my-project/project
[error] java.lang.NoClassDefFoundError: sbt/PlayInternalKeys
[error] Use 'last' for the full log
I am loading a custom sbt plugin.
What does that error mean?
(FYI, I'm assuming that last line says I can run play last. I can't. It gives the same error.)
For some reason, I found that my Play project wasn't pulling in the SNAPSHOT versions I was publishing to my local repo for the sbt plugin.
I had to increment the version numbers myself. When I did that, I did not see this error anymore. (I did continue to have to update the version when I changed the plugin.)
I have a little problem in Eclipse with a package . The error output is Package (name of package ) does not exist .
I have a package called de.baimos.blueid.lockserver.demo.exec . But Eclipse is looking for a package called de.baimos.blueid.lockserver.api.exec . This package is can be found in my Project nowhere .
My current situation is this: I have two projects that work as a project. Now you can in Eclipse under Properties - Add a project to a different > Project -> Java Build Path . But if I want to run Maven install I get the error above. At first I thought it would be in the pom.xml file . But I noticed that it is not possible to merge two pom.xml files. My project was to make the inheritance , however, by themselves , whom I put them together leads . Did anyone of you ever such a problem , or can someone help me ?
Thanks in advance for your help .
That is the error:
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[3,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[4,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[5,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[6,44] error: package de.baimos.blueid.lockserver.api.event does not exist
[ERROR] /home/test/workspace/HeartbeatService/src/main/java/de/baimos/blueid/lockserver/demo/exec/DemoCommandExecutionEventListener.java:[8,59] error: cannot find symbol
Maven can't see what you specify in Eclipse's Java Build Path; it's a command line tool that runs outside / without Eclipse.
Instead, you have to do mvn install in the first project.
Then you can add a dependency to this project in the second project's POM.
Maven will then make sure that Eclipse add the first project to the classpath as well without manually changing the build path in the UI.